CSS learning (3) style sheet
How to insert the stylesheet 1765243235
Method of inserting a style sheet in three ways:
- External style sheet (External style sheet)
- Internal style sheet (Internal style sheet)
- Inline style (Inline style)
External style sheet
When the style needs to be applied to many pages, an external style sheet would be the ideal choice. In the case of an external style sheet, you can change the appearance of the entire site by changing one file. Each page uses the <link> tag to link to the style sheet. <Link> tag (document) header:
Internal style sheet
When a single document requires a special style, you should use the internal style sheet. You can use the <style> tag defines internal style sheet in the document head, like this:
Inline style
Because you want to show and content mixed together, inline style loses many advantages out of style sheets. Use caution this method, for example, need only be applied when the style once in one element.
To use inline styles, you need to use the style (style) attribute in the relevant tag. Style attribute can contain any CSS property. This example shows how to change the color of the paragraph and left margins:
Multiple styles priorities
(Inline style) Inline style> (internal style) Internal style sheet> (external style) External style sheet> browser's default style
How to insert the stylesheet 1765243235
Method of inserting a style sheet in three ways:
- External style sheet (External style sheet)
- Internal style sheet (Internal style sheet)
- Inline style (Inline style)
External style sheet
When the style needs to be applied to many pages, an external style sheet would be the ideal choice. In the case of an external style sheet, you can change the appearance of the entire site by changing one file. Each page uses the <link> tag to link to the style sheet. <Link> tag (document) header:
Internal style sheet
When a single document requires a special style, you should use the internal style sheet. You can use the <style> tag defines internal style sheet in the document head, like this:
Inline style
Because you want to show and content mixed together, inline style loses many advantages out of style sheets. Use caution this method, for example, need only be applied when the style once in one element.
To use inline styles, you need to use the style (style) attribute in the relevant tag. Style attribute can contain any CSS property. This example shows how to change the color of the paragraph and left margins:
Multiple styles priorities
(Inline style) Inline style> (internal style) Internal style sheet> (external style) External style sheet> browser's default style