Rules and Style Sheets

You can create style sheets in two ways. You can either use a normal text editor and write the style sheets by hand or you can use a dedicated tool – for example, a Web authoring tool. The dedicated tools enable you to create style sheets without learning the syntax of the CSS language. However, in many cases, the designer wants to tweak the style sheet by hand afterwards, so we recommend that you learn to write and edit CSS by hand. Let's get started! Here is a simple example:

h1 { color: green }

This code is a simple CSS rule that contains one rule. A rule is a statement about one stylistic aspect of one or more elements. A style sheet is a set of one or more rules that apply to an HTML document. This rule sets the color of all first-level headings (h1).

HTML extension elements and their CSS equivalent.

ElementCSS equivalent
<tt> font-family: monospace
<i> font-style: italic
<b> font-weight: bold
<u> text-decoration: underline