Five methods for introducing CSS styles _ CSS/HTML

Source: Internet
Author: User
Five methods to introduce CSS Styles 1. Use STYLE attributes

Add the STYLE property directly to the tags of individual components, <元件(标签) style="性质(属性)1: 设定值1; 性质(属性)2: 设定值2; ...}

例如:

The advantage of this usage is that the style can be applied to various labels smartly, but the disadvantage is that there is no "uniformity" of the entire file 』.

Ii. Use STYLE labels

Write style rules inTag.

For example:

Generally, the entireStructure written on the webpage . The advantage of this usage is the uniformity of the entire file. As long as there is a declared component, this style rule will be applied. The disadvantage is that the flexibility of individual components is insufficient.

3. Use LINK labels

Write the style rules in the. CSS style file, and then use Label introduction.
Assume that we save the sample rules into an example.css file. We only need to add

You can apply the style specified in the style file. The LINK tag is usually written on a webpage.. The advantage of this method is that you can specify the same style file for all the files that apply the same style rules. The disadvantage is that the flexibility of individual files or components is insufficient.


4. Use @ import to introduce

It is similar to LINK usage, but it must be placed in.

For example:

Note that the semicolon at the end of the line is absolutely indispensable!

5. Use tags to introduce styles

For example, WEB standards

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.