Tips for Style Sheet Users

Now that style sheets have been around for a few years, Web authors have had the chance to use them and identify a number of best practices. The next few sections share some of these helpful hints.

Harnessing Inheritance

Inheritance refers to the fact that XHTML documents are essentially set up as hierarchies, and styles applied at one level of the hierarchy necessarily apply to all subordinate levels (except where explicitly overridden by a more local style) as well.

Therefore, if you assign style information in a <ul> element, the information also applies to all the items in the unordered list because the <li> elements are subordinate to the <ul>element.

If you weren't using embedded style information (the <style> ...

Get Platinum Edition Using XHTML™, XML, and Java™ 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.