When you read a style sheet, the browser formats the HTML document according to it. There are three ways to insert a style sheet:
1. External style sheet
An external style sheet is an ideal choice when a style needs to be applied to many pages. In the case of using an external style sheet, you can change the appearance of the entire site by changing a file. Each page is linked to the style sheet by using a label. Label in (document) header:
CSS "href=" Mystyle.css "/>"
2. Internal style sheet
When a single document requires a special style, you should use an internal style sheet. You can use
3, inline style
Because you want to mix performance and content together, inline styles can lose many of the advantages of the style sheet. Use this method with caution, such as when a style only needs to be applied on one element at a time. To use inline styles, you need to use style attributes in the relevant tags. The Style property can contain any CSS properties. This example shows how to change the color and left margin of a paragraph:
This is a paragraph
Multiple styles
If some attributes are defined by the same selector in a different style sheet, the property value is inherited from a more specific stylesheet.
For example, an external style sheet has three properties for the H3 selector:
h3 {
color:red;
Text-align:left;
font-size:8pt;
and the internal style sheet has two properties for the H3 selector:
h3 {
Text-align:right;
font-size:20pt;
}
If this page with an internal style sheet is connected to an external style table, then the H3 gets the following style:
color:red;
Text-align:right;
font-size:20pt;
That is, the color properties are inherited from the external style sheet, while the text flow (text-alignment) and font dimensions (font-size) are replaced by rules in the internal style sheet.