Prev | Current Page 43 | Next

Charles Wyke-Smith

"Stylin' with CSS: A Designer's Guide 2nd Edition"

Because the only purpose of a class or ID is to give an element a name
that you can reference in your style sheet (or JavaScript code), the value can be a word of your own choosing. That
said, it??™s good practice to name classes and IDs something meaningful such as class="navigationbar" rather than
class="deadrat". Although the deadrat class might provide a moment of levity during a grueling programming session,
the humor may be lost on you when you are editing your code at some point in the future. Don??™t save time with
abbreviated names either; call the ID "footer" rather than "fr" or you are apt to waste your time (or someone else??™s)
later trying to ?¬? gure out what you meant. Do yourself a favor and take the time to give classes and IDs unambiguous and
descriptive names.
Document Hierarchy: Meet the XHTML
Family
Document hierarchy is the ?¬? nal XHTML concept we??™ll look at before
we start looking at CSS. The document hierarchy is like a family tree
or an organizational chart that is based on the nesting of a page??™s
XHTML tags. A good way to learn to understand this concept is to
take a snip of the body section of the markup we just discussed and
strip out the content so that you can see the organization of the tags
better. Here??™s the stripped-down header




Now you can clearly see the relationships of the tags.


Pages:
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55