HTML and CSS Reference
In-Depth Information
When to use (and not use) comment tags
A general problem with comment tags is that they're not used suffi ciently in a Web page. Sometimes
a few comments suffi ce — and if a page only needs a few, you shouldn't add more. Other times, a
page needs a good deal more comments than it has. The number of comments required depends
completely on the size and scope of the Web project and whether you're working by yourself or with
other developers.
However, sometimes developers get carried away and have so many comment tags that you can't see
the fl ow of the HTML code. A page with a long comment after every tag can act like barbed wire in a
fi eld — you keep tripping over it and can't reach your destination. If a large number of comments are
required for a complex page, put them together in a single container, and then the other developers
can see the HTML code and understand how it's used.
Once you've made the changes by commenting out the unwanted tags, you display it to your
client again, as shown in Figure 2-5.
Figure 2-5: The page with the commented-out code.
If the client likes the original better, all you have to do is remove the comment tags, and
the page will look like it did before. You may want to experiment with several dif erent
appearances; by using the comment tag, you can quickly change it while keeping the
original tags — they're just commented out.
When you create an HTML page, you may nest tags —you can place one HTML5 container
within another container. In fact, I've been doing that all along. h e rule is: Add an end tag
inside of a container before the container's end tag. So, if you're writing a tag within another
tag's container, be sure to close the inside container before closing the outside container. Look
at the following examples to see what I mean.
Search WWH ::

Custom Search