Style 1 - The Header

Let's take a look at the first example how to define a style using CSS.

We begin by defining a <STYLE> tag in the header of the document. The <STYLE> tag allows you to define the look of an HTML tag. Example:

<STYLE type="text/css">
  B { color:red }
This is an example of <B>red text</B>.
Let's examine what this does. After the style definition, notice the HTML comment codes <!-- and -->. This is used so that older browsers won't be confused by the style commands.

Next is the style definition. It begins with the name of the HTML tag to modify (the selector). Then the rules for the modification are contained within the curly braces. In our example, we only have one rule which says to use the color red. Now, whenever you use the <B> tag, the text will be red. See this example.

Later on we'll talk about more styles and properties you can use in your documents. For now, we're going to focus on the basics of how to use it. If you wish to include multiple properties within the same definition, seperate them by semi-colons:

  B { color:red; font-style:italic }

Previous Section
Table of Contents Next Section
Style 2