style Attribute (deprecated)


 

Where to use the style Attribute

style is a Common Attribute from the Core Attribute Collection and is of Type CDATA.

It may be used on most elements in the Element Index - all except: base, head, html, meta, param, script, style, title.


Description

NOTE: The Style Attribute Module, which contains only the style attribute, is deprecated in XHTML 1.1.

This attribute allows a set of style declarations to be applied to an individual XHTML element within the XHTML itself, rather than by using selectors in an external style sheet or a style element. Its use is now deprecated. If you do use the style attribute in your document, however, you should indicate the MIME type of the style declarations (typically "text/css") in a Content-Style-Type HTTP header.

Example (using CSS styles):

<div style="background-color:#eee; color:#900; border:1px solid #00f; padding:0.5em">
    This div has a grey background, red text, a blue border and 0.5em of padding all around.
</div>

This renders as:

This div has a grey background, red text, a blue border and 0.5em of padding all around.

Page Footer & Copyright

Copyright © Sally Maughan 2005-2009 (Page last updated on 16 May 2009)

*Valid XHTML 1.1 - hosted by *Openstrike

Content based on the W3C Working Draft: *XHTML 1.1 and Recommendation: *XHTML Modularisation 1.1.

W3C, XHTML, XML, HTML, CSS and MathML are *Trademarks of the W3C (*MIT, *ERCIM, *Keio) with which the site's author has no connection.


Up, Next & Previous Links

Your Location

Home > XHTML 1.1 Home > XHTML 1.1 Indexes > Attribute Index (XHTML 1.1) > style Attribute (deprecated) (XHTML 1.1)