style

FilterElements

<style> ... </style>

Inserts style information (commonly Cascading Style Sheets) into the head of a document.

Notes

In HTML5, the style element may be used in the content of the document.

Start/End Tags

Required/Required

Specifications

  • HTML 4.01
  • HTML5

id=

Values: text
XHTML and XHTML5 only. Assigns a unique identifying name to the element.

media=

Values: all | aural | braille | handheld | print | projection | screen | tty | tv
Specifies the intended destination medium for the style information. It may be a single keyword or a comma-separated list. The default in the HTML 4.01 spec is screen. In HTML5, the default is all.

scoped

Values: None in HTML. (scoped="scoped" in XHTML5)
HTML5 only. Applies the styles only to the local document tree (i.e., only the descendants of the parent of the style element).

title=

Values: text
Gives the embedded style sheet a title.

type=

Values: content type (text/css)
Required in HTML 4.01. Specifies the style sheet language. For Cascading Style Sheets (currently the only style type option), the value is text/css. In HTML5, the type attribute is optional if using CSS.

xml:space=

Values: preserve
XHTML only. Instructs XML processors to preserve the whitespace in the element.

Note that the type attribute is optional in HTML5 when using CSS.

<head>
<style type="text/css">
  h1 {color: #666;}
</style>
<title>Scientific Presentation</title>
</head>

Rendered Example

style is a non-rendering element.