Next / Previous / Contents / TCC Help System / NM Tech homepage

8.6. The style element: Specifying presentation style

The best way to specify style is to attach an external CSS stylesheet to the document using the link element with a rel='stylesheet' attribute; see Section 8.4, “The link element: Related documents”.

However, you can include CSS stylesheet rules directly in your document using the style element.

element style
{ attribute type { text },
  attribute xsl:lang { text },
  attribute media { text }?,
  text  
}
type

This required attribute specifies the MIME type of the stylesheet. This will usually be type='text/css'. For other possible values, see Section 6.7, “MIME types: Defining a resource's format”.

xsl:lang

Specifies the language used in the title attribute. See Section 15.1, “The xml:lang attribute”.

media

You can supply multiple style sheets for different media. In that case, use the media attribute in each style element to specify the kind of media; see Section 6.6, “Media type”.

Here's a brief example. The CSS rules here specify that level h1 headings will use navy blue type, and the page background will be silver.

<style type='text/css'>
  h1 { color: blue; }
  body { background-color: silver; }
</style>