Home >Web Front-end >CSS Tutorial >Five ways to introduce CSS styles_CSS/HTML

Five ways to introduce CSS styles_CSS/HTML

WBOY
WBOYOriginal
2016-05-16 12:11:081789browse

1. Use the STYLE attribute

Add the STYLE attribute directly to individual component tags,
The advantage of this usage is Styles can be applied flexibly to each tag, but the disadvantage is that there is no "uniformity" in the entire document

.

2. Use STYLE tag

Write style rules in tags.

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 LINK tag

Write the style rules in the .css style file and import it with the tag.
Suppose we save the style rules as an example.css file, we only need to add

The style specified in the style file can be applied. The LINK tag is usually 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 similar to LINK usage, but must be placed in .

For example:

It should be noted that the semicolon at the end of the line is absolutely essential!

5. Use the tag to introduce styles

For example: WEB Standard

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