17. XHTML Style Attribute Module

This section is normative.

The Style Attribute Module defines the style attribute. When this module is selected, it activates the Style Collection.

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.

Implementation: RELAX NG

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. For example, for [CSS2] inline style, use the declaration block syntax described in the Style Sheet Module (without curly brace delimiters).

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.

Style Attributes and Generic XML

There is currently no way to declare what attribute within a given namespace contains "styling" information in a way that a Generic XML processor can discern. In an ideal world, someone would define such a mechanism (e.g., through the xml-stylesheet PI).