CSS Platforms

Starting with Cascading Style Sheet Level 1, you can use an attribute of the STYLE element to specify the syntax you are using to define style sheets. The value of the TYPE attribute is in the form of a content-type declaration; it defines the syntax used to assign style attributes. The formal CSS recommendation by the W3C promotes a syntax of content type text/css . This TYPE attribute is not required in today’s leading browsers, but the CSS recommendation does not believe that there should be a default type. Therefore, I strongly recommend specifying the TYPE attribute for all style sheets, in case some other user agent (an HTML-empowered email reader, for example) should implement a strict interpretation of the CSS standard in the future. A STYLE element that relies on the CSS syntax should look like the following:

<STYLE TYPE="text/css">
...
</STYLE>

Internet Explorer 4 and Navigator 4 both recognize the text/css type of CSS syntax. Navigator 4 also includes an alternative syntax that follows the JavaScript object reference format. This alternate type, text/javascript, provides Java-Script equivalents for most of the style attributes and structures provided by the text/css syntax. The Navigator implementation also includes the power to use JavaScript statements and constructions inside <STYLE> tags to assist in defining styles based on client- or user-specific settings (as demonstrated later in this chapter). In other words, the implementation of style sheets ...

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.