There are three ways to insert a style sheet, namely:
1. External style sheet;
2. Internal style sheet;
3. Inline style
External style sheet
When using an external style sheet, you can change the appearance of the entire site by changing one file. . Each page links to the style sheet using the tag. tag in the head (of the document):
The example is as follows:
<head><link rel="stylesheet" type="text/css" href="mystyle.css"></head>
The browser will read the style declaration from the file mystyle.css and format the document according to it.
External style sheets can be edited in any text editor. The file cannot contain any html tags. Style sheets should be saved with a .css extension. The following is an example of a style sheet file:
hr {color:sienna;} p {margin-left:20px;} body {background-image:url("/images/back40.gif");}
Note: Do not leave a space between the attribute value and the unit (such as: "margin-left: 20 px"). The correct way to write it is " margin-left: 20px" .
(Video tutorial recommendation: css video tutorial)
Internal style sheet
When a single document needs special When styling, you should use an internal style sheet. You can define an internal style sheet in the head of the document using the