Prev | Current Page 30 | Next

Charles Wyke-Smith

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

microsoft.com/workshop/author/
dhtml/reference/charsets/charset4.asp).
4. Close every tag, whether enclosing or nonenclosing. Enclosing
tags have content within them, like this

This is a paragraph of text inside paragraph tags. To
be XHTML-compliant, it must, and in this case does, have
a closing tag.


Nonenclosing tags do not go around text but still must be
closed, using space-slash at the end, like this
My cat
The space before the slash isn??™t required in modern browsers,
but I always add it as it??™s easier to see that the tag is correctly
closed.
5. All tags must be nested correctly. If a tag opens before a preceding
one closes, it must be closed before that preceding one
closes. For example:

It??™s very important to nest tags
correctly.


Here, the strong tag is correctly placed inside the

; it closes
before the containing p tag is closed. A tag enclosed inside
another in this way is said to be nested.
This is wrongly nested

The nesting of these tags is wrong.

strong>
Multiple elements can be nested inside a containing element; a
list nests multiple li elements inside a single ul or ol element,
like this:

  • Item 1

  • Item 2

  • Item 3


XHTML: GIVING STRUCTURE TO CONTENT 15
Because CSS relies on proper nesting in order to target styles
to elements, you have to get this right.


Pages:
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42