Just to add a final note on the whole style hierarchy/cascade thing - there's also a hierarchy in terms of where a style is defined.
There are three main places you can define CSS styles:
1. An external stylesheet (e.g. a file "style.css") referred to in the HEAD section of an HTML file using the LINK element, e.g.:
Code:
<link rel="stylesheet" type="text/css" href="../Styles/style.css" />
2. An embedded stylesheet contained in the HEAD section of an HTML file using the STYLE element, e.g.:
Code:
<style type="text/css">
p {
margin-top: 1em;
margin-bottom: 1em;
text-indent: 0.3em;
}
</style>
3. Inline styles applied to individual elements in the HTML code using the STYLE attribute, e.g.:
Code:
<p style="margin-top:1em;margin-bottom:1em;text-indent:0.3em;">bla bla bla</p>
As before, the "closer" it is to the HTML element, the higher a style is in the "hierarchy". So styles defined in an embedded stylesheet overrule styles defined in an external stylesheet, and styles defined in a STYLE attribute for an individual element overrule styles defined in an external stylesheet and/or an embedded stylesheet.