HTML features

HTML contains elements and attributes that have been included specifically to facilitate styling by the CSS mechanism. Conversely, the CSS standard itself contains features aimed at its use with HTML documents. This section is aimed at readers who also work with HTML (either directly, or as an output format derived from XML source documents), and would like to apply CSS to HTML documents.

New attributes (Style and Class)

A new attribute, called Style, appears in the HTML 4.0 standard. This attribute contains a style rule that applies only to the specific instance of the element containing it. This in-line rule overrides all other rules:

<!-- HTML -->
h3   { color: blue }
...
<h3>Blue Header</h3>
...
<h3 style="color: green">Green ...

Get XML Companion, The, Third Edition 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.