Applying a Style



There are three ways of applying a style to an HTML or XHTML document. Each approach has its own advantages and disadvantages, and you’ll probably use some combination of all three in developing your Web sites.



Inline Styles

A style is applied to a specific element through the use of the style attribute in the element’s tag.


Advantages: Disadvantages:

Embedded Styles:

A style sheet is placed in a document’s head, setting the style definitions for the document’s elements.


Advantages:
Disadvantages:

External Styles

A style sheet is saved in a separate document and is applied to a group of pages in a Web site.


Advantages: Disadvantages:

Using External Style Sheets

To link a Web page to an external style sheet, you use the link element. The link element is most often used to link to style sheets, however. To create a link to an external style sheet, add the following tag to the head element on of the Web document:

Another way to access an external style sheet is to import the content of one style sheet into another. To import a style sheet, add the following statement to either an embedded or an external style sheet:



Hosted by www.Geocities.ws

1