Free computer Tutorials

HOME Stay at Home and Learn

Cascading Style Sheets

The STYLE Tags

Computer Tutorials List
 

Adding the Style Tags to your HTML

 

A style sheet is set up by using the word STYLE in between two angle brackets. An end STYLE tag is needed to tell the browser to stop formatting the style:

<STYLE>

</STYLE>

Your style sheet code then goes between the two Style tags. Here's a style that can change text blue:

<STYLE>

.Font1 {Color: Blue}

</STYLE>


<DIV Class = Font1>
This is my text
</DIV>

Although you may not understand the code layout yet, the point is that you can add other styles to the one above that we have called Font1. We can add a bold style and a size style:

<STYLE>

.Font1 {
Color: Blue;
Font-size: 24;
Font-weight: Bold;
}

</STYLE>

Now, the part of the code where we applied the style (the DIV) part will have its text updated. We don't have to make any changes at all to the DIV part of the code.

So a style is way to change blocks of code (or even individual words) and apply formatting to the block as a whole. You don't need individual HTML tags in the BODY of your page; just using the style name once will ensure that your formatting is applied to the whole block.

 

<-- Back One Page Move on to the Next Part -->

<--Back to the Style Sheets Contents Page

View all our Home Study Computer Courses