HTML and CSS Reference
In-Depth Information
h3 {
color: #666; /* I switched the h3 color to this lighter
gray for increased contrast - jcroft, 06/14/2006 */
}
It's a good idea to sign and date your comments, especially if you're working on a team.
It's always nice to be able to ask the person in the cubicle next to you why he or she did what
they did when you're trying to make sense of code you didn't write. Another helpful concept is
that of standardizing on several comment openers that have meaning to you or your team. For
example, you may start a comment with TODO for pieces of code that need to be completed, or
BUG for pieces of code you know need fixing. These types of flags create an easy way for you or
your team members to search for specific tasks within the code. Here are a few more examples
of this type of notation:
/* TODO: The h1s need further styling, but this gets us started. */
h1 {
color: #333
}
/* BUG: This doesn't seem to work as I intended.
Anyone have ideas on how to fix it? */
h2 {
float: left;
width: 200px;
margin-right: 20px;
font-family: Georgia, serif;
}
/* KLUDGE: It's not a very elegant solution, but I used
the negative margin here to achieve
the positioning I wanted. It works, but if someone else
has a better way, go for it. */
h3 {
display: block;
margin-left: -11px;
}
Comments for Metadata
A great practice to get into the habit of is saving a chunk of metadata (literally “data about
data”) at the top of your CSS files so that anyone else who sees the file will have a bit of context
to go on while parsing it. An example might look something like this:
/* -------------------------------------
Filename: base.css
Title : Primary CSS file for jeffcroft.com
Author : Jeff Croft, jeff@jeffcroft.com
URL : http://media.jeffcroft.com/css/base.css
Search WWH ::




Custom Search