29. XHTML Style Attribute Module


This section is normative.

The Style Attribute Module defines the style attribute.

Note: use of the @style attribute is strongly discouraged in favor of the style element and external style sheets. In addition, content developers are advised to avoid use of the @style attribute on content intended for use on small devices, since those devices may not support the use of in-line styles.

29.1. Style Attribute Collection

style = CDATA
This attribute specifies style information for the current element.

The syntax of the value of the @style attribute is determined by the default style sheet language.

This CSS example sets color and font size information for the text in a specific paragraph.


<p style="font-size: 12pt; color: fuchsia">
   Aren't style sheets wonderful?</p>

In CSS, property declarations have the form "name : value" and are separated by a semi-colon.

To specify style information for more than one element, authors should use the style element. For optimal flexibility, authors should define styles in external style sheets.

Implementations: RELAX NG, XML Schema