HTML and CSS Reference
In-Depth Information
h5 {text-align: center}
h6 {text-align: center}
Both styles tell the browser to center the contents of header levels 1
through 6. For most authors, the first version is easier to type, under-
stand, and modify. And it takes less time and fewer resources to trans-
mit across a network, though the effect is trivial. Define styles in the
manner that is most comfortable for you. You don't have to use multiple
selectors.
8.2.3. Contextual Selectors
Normally, the styles-conscious browser applies document-level or im-
ported styles to a tag's contents wherever they appear in your docu-
ment, without regard to context. However, the CSS2 standard defines
a way to have a style applied only when a tag occurs within a certain
context within a document, such as when it is nested within other tags.
To create a contextual selector, list the tags in the order in which they
should be nested in your document, outermost tag first. Then, when the
browser encounters that nesting order, the style properties are applied
to the last tag in the list.
For example, here's how you might use contextual styles to create a
classic outline, complete with uppercase Roman numerals for the outer
level, capital letters for the next level, Arabic numerals for the next, and
lowercase letters for the innermost level:
ol li {list-style: upper-roman}
ol ol li {list-style: upper-alpha}
ol ol ol li {list-style: decimal}
ol ol ol ol li {list-style: lower-alpha}
According to the example stylesheet, when the styles-conscious browser
encounters the <li> tag nested within one <ol> tag, it uses the upper-
 
Search WWH ::




Custom Search