Home  >  Article  >  Web Front-end  >  Introduction to four ways to introduce css style sheets

Introduction to four ways to introduce css style sheets

高洛峰
高洛峰Original
2016-12-16 15:44:281849browse

1. Use the STYLE attribute: Add the STYLE attribute directly to individual component tags.


The advantage of this usage is that it can flexibly apply styles to each tag, but the disadvantage is that there is no entire document. Unity'.

2. Use the STYLE tag: Write the style rules in the tag.


For example:

Usually the entire structure is written in the section of the web page. The advantage of this usage lies in the uniformity of the entire document. As long as there is a declared component, the style rule will be applied. The disadvantage is the lack of flexibility in individual components.

3. Use the LINK tag: Write the style rules in the .css style file, and then introduce it with the tag.

Suppose we save the style rules as an example.css file, we only need to add

to the web page to apply it The style specified in the style file. Usually the LINK tag is written in the section of the web page. The advantage of this usage is that you can assign several documents to which the same style rules apply to the same style file. The disadvantage is also the lack of flexibility in individual files or components.

4. Use @import to introduce: It is very similar to LINK usage, but must be placed in .

For example:

To Note that the semicolon at the end of the line is absolutely essential!



For more introduction to the four ways to introduce css style sheets, please pay attention to the PHP Chinese website for related articles!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn