Five ways to introduce CSS styles _css/html

Source: Internet
Author: User
First, use the Style property

Add the style attribute directly to the individual component label, <元件(标签) style="性质(属性)1: 设定值1; 性质(属性)2: 设定值2; ...}

例如:

The advantage of this usage is that it is dexterous to apply styles to each label, but the disadvantage is that there is no "uniformity" of the entire document.

Second, use Style label

Write the style rule in the label.

For example:

Usually the whole structure is written in the part of the Web page. The advantage of this usage is that the entire document is uniform, as long as it is a declared component that applies the style rule. The disadvantage is that the flexibility of individual components is insufficient.

Third, use the link tag

Write style rules in a. CSS style file, and then introduce them as tags.
Let's say we save the style rule as a example.css file, we just add it to the page

You can apply the styles you've made in the style file. The link tag is usually written in the section of the Web page. The advantage of this usage is that you can assign the same style file to a number of files that you want to apply the same style rule to. Disadvantages are also insufficient in the flexibility of individual files or components.


Iv. introduction of using @import

Much like link usage, but must be placed in .

For example:

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

V. Using tags to introduce styles

For example,Web standards

  • Related Article

    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.