Cascading Style Sheets

CSS is a programming language that has become the standard practice for layout and presentation on the web. Originally style and layout elements like font, size, color, ect.. were intermixed with the HTML, for example:

<font color="red" size="3">Text</font>

CSS allows for a separation of content and formatting. This is accomplished by adding a class or id to an HTML element and then specifying the style in the head of the HTML document or in an external style sheet. Fore example:

<p class="header">Text</p>

and the corresponding CSS would be:

p.header { font-size:18px; color:red; }

Furthermore, HTML elements without a class can be styled by only specifying an HTML element in the CSS and no class or id. The cascading aspect is very handy and allows for multiple levels of style to be applied to one element (or a group of elements), cascading to the final style, canceling out any overridden styles. This enables scope, specifying styles site wide or to specific elements.

Comment