<style> ... </style>
Available in versions: 3.2, 4.0
The <style> tag is used to create document-level style
sheet rules.
It is referred to as document-level because the style rules will apply to
the entire HTML page.
In contrast, the style core attribute behaves as an inline style rule
and only effects a small portion the HTML document.
The style tag must appear inside the head element.
The code, contained between the opening and closing style tags,
is not HTML, but is CSS (Cascading Style Sheets).
The general concept is that a CSS property is assigned to a selector keyword,
such as an HTML tag.
Unfortunately, not all browsers (especially older browsers) recognize this tag.
It is recommended that you place an HTML opening comment tag right
after the opening style tag and a closing comment tag immediately before the
closing /style tag.
A browser that recognizes CSS will ignore these comment tags and execute the code.
Conversely, a browser that does not recognize CSS will treat the contents
as simply a comment.
The closing tag is mandatory.
Core Attributes
dir
lang
title
Attributes
media
The media attribute is a comma-separated list of one or more types
of media in which the HTML document may appear
(all, aural, braille, handheld, print, projection, screen, tv, and tty).
The default is screen.
This attribute is very poorly implemented.
type
The type attribute is used to define the type of style being used.
The two permitted values are text/css and text/javascript.
Since there is no default value, it may prove wise to always include
this attribute in the style tag.
Here is a simple example of creating document-level style rules.
A series of CSS properties defining font face, color, and size is assigned
to the br, pre, and code tags.
For more information about style sheets, please click on the Style Sheets link
in the left menu frame under the
Technologies heading.
Code:
<style type="text/css">
<!--
br { font-face: arial; color: black; font-size: 12px" }
pre { font-face: arial; color: red; font-size: 18px" }
code { font-face: courier; color: blue; font-size: 15px" }
-->
</style>
Copyright 2000 by Infinite Software
Solutions, Inc.
Trademark Information
|