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

29.2. Issues

RE: [BULK] - Re: [XHTML2] Spirit of "1.1.3. XHTML 2 and Presentation" PR #7870
State: Approved
Resolution: Accepted
User: None

The working group resolved at the f2f meeting in June 08 to remove this attribute and to permit the style element throughout the content model.

Re: [BULK] - Re: [XHTML2] Spirit of "1.1.3. XHTML 2 and Presentation" PR #7871
State: Approved
Resolution: Reject
User: None

We are removing the style attribute, but we are ensuring that it is possible to embed style definitions via the style element or the link element anywhere in your document.