The <STYLE> element should reside within the <HEAD> element and is used to delimit Style Sheet information.

The TYPE and TITLE attributes can be used within the <STYLE> element. TYPE is used to specify the internet media (MIME) type of the style sheet definition (which is "text/css") and TITLE can be used to provide a title for the style sheet definitions. This may be used by browsers when a choice of style sheets are available.

For example :

<TITLE>Introduction to Style Sheets</TITLE>
<STYLE TYPE="text/css" TITLE="Bright Colours">
BODY { color : white}
P { color : blue;
font-size : 12pt;
font-family : Arial}
H1 { color : red;
font-size : 18pt}

Defines the styles that are specified within the <STYLE> ... </STYLE> elements to be a style sheet, having the title "Bright Colours". For more information about Style Sheets, see the Style Sheets topic.

NOTE : Use of the <STYLE> element and Style Sheet use is only supported by Internet Explorer (from v3.0) and Netscape (from v4.0).

Recent HTML 4.0 draft specifications have included a MEDIA attribute for the <STYLE> element, which specifies the output device. Defaulting to screen, the MEDIA attribute can have the following properties.

Value Meaning
screen The style sheet settings given are those that will be used for computer display screen purposes.
print The style sheet settings are suitable for printed output (typically, they'd contain hard-coded page breaks for example)
projection The settings are suitable for display on projectors
braille The settings are to be used for braille machine output
speech The document is styled to be suitable for speech synthesiser output
all The style sheet settings are to be used for all output devices

Using the MEDIA attribute, different style sheets can be set up to be used when the document is used in different display environments. Note : Netscape and Internet Explorer both purport to support use of the MEDIA element, but at the time of writing, no such support existed. As they are by nature, screen output devices, it's likely that support may not get implemented. This attribute is detailed here for completeness.

This Internet Explorer 4.0 specific attribute specifies that the StyleSheet object specified in the <STYLE> element is disabled. Basically, it means its style sheet declarations won't be used.

The <STYLE> element, in accordance with the Internet Explorer Dynamic HTML, supports some of the standard properties and methods.

<STYLE...> Properties
Of the Standard Dynamic HTML properties, the <STYLE> element supports document, id, parentElement, sourceIndex and tagName. It also supports the type property, which reflects any settings of the TYPE attribute (see above). See the Standard Dynamic HTML properties topic for more details.

<STYLE...> Methods
Of the Standard Dynamic HTML Methods, the <STYLE> element supports contains, getAttribute, removeAttribute and setAttribute. See the Standard Dynamic HTML Methods topic for more details.