Local (inline) stylesheet declarations, specific to a single instance on a page, can be used instead of tags to specify font size, color, and typeface and to define margins, leading, etc.
1
2
font-family:Arial, Helvetica, non-serif">
3
This is a local stylesheet declaration.
4
Global (embedded) stylesheet declarations, applicable to an entire document, are defined within the and tags, which precede the tag in the HTML document and are usually placed in the header.
To embed a global stylesheet in your HTML document:
Linked stylesheet declarations use a single stylesheet (in a separate file, saved with the .css suffix) to define multiple pages. A typical .css file is a text file containing style rules, as here:
1
P {font-family:non-serif; font-size:medium; color:red}
To apply a .css stylesheet (“style.css” in the example below) to an HTML page, a tag is added to the page header:
1
2
"stylesheet"href="style.css"type="text/css">
3
Inheritance
In cases where local, global, and linked style definitions conflict, the most specific stylesheet will generally take precedence:local overrides global, global overrides linked. Similarly, inline style attributes override ID, ID overrides class, and class overrides stylesheet-defined HTML elements.