HTML Class - Fall 2002HTML StylesWith HTML 4.0 all formatting can be moved out of the HTML document and into a separate style sheet. How to Use StylesWhen a browser reads a style sheet, it will format the document according to it. There are three ways of inserting a style sheet: External Style SheetAn external style sheet is ideal when the style is applied to many pages. With an external style sheet, you can change the look of an entire Web site by changing one file. Each page must link to the style sheet using the <link> tag. The <link> tag goes inside the head section. Internal Style SheetAn internal style sheet should be used when a single document has a unique style. You define internal styles in the head section with the <style> tag. Inline StylesAn inline style should be used when a unique style is to be applied to a single occurrence of an element. To use inline styles you use the style attribute in the relevant tag. The style attribute can contain any CSS property. The example shows how to change the color and the left margin of a paragraph: To learn more about styles, visit our CSS tutorial. Style Tags
|