Core attributes

Some useful attributes are available to almost every XHTML element. The most ubiquitous are four core attributes: Style, Class, Title and Id. However, none of these attributes are required to be present in any particular element. There are few elements that cannot use them, but they include the structural tags (Html, Head and Title), background scripts (Script, Style and Area), applet tags (Applet and Param) and meta-data (Base, Basefont and Meta).

Style

The Style attribute allows CSS in-line styles to be applied (see Chapters 24 and 25). These in-line styles consist of CSS properties and values, separated by semicolons:

<p style="color: yellow ; background-color: black"> This paragraph will be styled in yellow on a black background.</p> ...

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.