Five ways to introduce CSS styles into web design

Source: Internet
Author: User
Tags advantage
css| Design | Web page design

  first, use the Style property

Add the STYLE attribute directly to the individual component label, the component (label) style= Property 1: Set value 1; Property (Attribute) 2: Set value 2; ...}

For example:



The advantage of this usage is that it can be used neatly in each label, but the disadvantage is that there is no "uniformity" of the whole document.

  second, use the style label

Write style rules in label.



For example:



Typically, the entire structure is written in the part of the Web page. The advantage of this usage is the uniformity of the entire document, as long as the declared component will apply the style rule. The disadvantage is that the flexibility of individual components is insufficient.

  third, use link tag

Write style rules in the style file of the. css, and then introduce them with the tag.

Let's say we put the style rules into a example.css file and we just add them to the page.


You can apply this style file to a good style. Typically, you write a link label in the section of a Web page. The advantage of this usage is that you can assign several files of the same style rule to the same style file. Disadvantages are also insufficient flexibility in individual files or components.

  Iv. introduction of using @import

Similar to link usage, but must be placed in the .



For example:



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

  V. Introducing styles using the tag

For example: page



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.