CSS, Cascading Style Sheet Basics – The Style Placement

Using a style sheet to define a web page is a good way to get consistency in page design from one page to another on a web site. The style can be placed in the web page directly or it can be placed in a separate file and called by a link from the web page.

CSS Within A Page

Using a style within a page is easy to define with the HTML tag <STYLE>. The type of style is “text/css”. So that tag would be <STYLE type=”text/css”>. Then everything after this tag would be the styles.

CSS Called From An External File

Using a style sheet that is called from an external file is a good way to have consistency between pages on a web site, since the same style can be used in each page without having to define it all over again in each web page.

The HTML tag to accomplish this is the LINK tag <LINK>. It contains 3 attributes, the href, rel, and the type. The whole tag would be <link href=”Style.css” rel=”stylesheet”>. What comes after the href is the name of the file and location of the style sheet file. In this case the style sheet is in the same directory as the web page that is using it, so only the “Style.css” file name is necessary.

Examples of how this is used will be shown in the coming CSS posts …

By: Tech Master Jim

Leave a comment

Your email address will not be published. Required fields are marked *