Inline style table:Directly write it in the existing HTML, such as <P style = "color: Red"> text in red </P>
Embedded style sheet:Use the "<style> </style>" label to embed it into the header of an HTML file, for example, <style type = "text/CSS">
<! --
. Warning
{}{
Color: red
}
-->
</Style>
Note: The comment label in <style> is used to display the content of the style sheet on the screen when the browser does not support the style sheet.
External style table:The external file of the sample table is extension .css, And the <link> label is used within the
The above three methods can be used as needed. However, in practice, external style tables are recommended based on the separation of performance and content. Their advantages are as follows:
1. It is independent of HTML files for easy modification.
2. Multiple files can reference the same style table file to ensure the uniformity of the page appearance.
3. You only need to download the style sheet file once and can use it on other pages linked to the file.
4. the browser displays HTML content first and then renders the content based on the style sheet file, so that visitors can see the content more quickly.
However, embedded style sheets and inline style sheets must be used flexibly in special cases.
In addition, there is a "imported style sheet", which uses "@ import" to import an external style sheet file, which needs to be written in the <style> label, for example: <style type = "text/CSS" Media = "all"> @importurl(basic.css); </style>
This is often used to replace the <link> tag connecting CSS to HTML. The advantage of this is that some old browsers do not accept the @ rule and do not connect to the style sheet. At this time, if the page has a good structure, the HTML with simple functions is left. Although there is no gorgeous appearance, visitors can still view the content well.