Prev | Current Page 127 | Next

Craig Grannell

"The Essential Guide to CSS and HTML Web Design"

Always using the most appropriate relevant
element means that you can later individually style each element in CSS, overriding the
default appearance if you wish. If the likes of citations, defining instances, and variables
are all marked up with i instead of cite, dfn, and var, there??™s no way of distinguishing
each type of content and no way of manipulating their appearance on an individual basis.
Well-formed markup involves more than ensuring visual flexibility, though. Use of the cite
tag, for instance, enables you to manipulate the Document Object Model (DOM) to
extract a bibliography or list of quotations from a page or even a full website. The ability
to style logical tags like this with CSS is likely to be of increasing rather than diminishing
importance.
The importance of end tags
While we??™re on the subject of well-formed markup, we??™ll revisit the importance of end
tags. As mentioned earlier, XHTML demands that all tags be closed. Most browsers let you
get away with ignoring some end tags, though, such as on paragraphs. Some designers may
still have bad habits from working with HTML, for which many end tags are optional. Omit
many others at your peril. For instance, overlook a heading element end tag and a browser
considers subsequent content to be part of the heading and displays it accordingly. As
shown in the following image, two paragraphs are displayed as a heading because the earlier
heading element lacks an end tag.


Pages:
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139