Summary of four methods for adding CSS style sheets to web pages. You can choose your favorite method according to your needs.
1. Use the STYLE attribute: Add the STYLE attribute directly to individual component tags.
The advantage of this usage is that the style can be flexibly applied to each label. But the disadvantage is that there is no "unity" in the entire document.
2. Use the STYLE tag: Write the style rules in the tag.
The code is as follows:
<STYLE TYPE="text/css"> <!-- 样式规则表 --> </STYLE> 例如: <STYLE TYPE="text/css"> <!-- BODY { color: BLUE; background: #FFFFCC; font-size: 9pt} TD, P { COLOR: GREEN; font-size: 9pt} --> </STYLE>
Usually the entire structure is written in the
The code is as follows:
<STYLE TYPE="text/css"> <!-- @import url(引入的样式表的位址、路径与档名); --> </STYLE> 例如: <STYLE TYPE="text/css"> <!-- @import url(http://yourweb/ example.css); --> </STYLE>
It should be noted that the semicolon at the end of the line is absolutely essential! In this way,
@import url(http://yourweb/ example.css);
can also be added to other styles to call.
The above is the detailed content of Summary of four methods to add CSS style sheets to web pages. For more information, please follow other related articles on the PHP Chinese website!