Three CSS styles and three CSS styles

Source: Internet
Author: User

Three CSS styles and three CSS styles

From the perspective of CSS style code insertion, there are three types: inline, embedded, and external.

 

1: inlineThe css style sheet directly writes the css code in the existing HTML Tag, as shown in the following code:

<p>

3: the external css style is written in a separate file.

 

The external css style (also known as the external style) is to write the css code into a separate external file. This css style File.css"Is the extension. in

<link href="base.css" rel="stylesheet" type="text/css" />

Note:

1. the css style file name should be named with meaningful English letters, such as main.css.

2. rel = "stylesheet" type = "text/css" is a fixed writing method that cannot be modified.

3. The <link> tag location is generally written in the

These three styles have priorities. remember their priorities:Inline> embedded> externalBut embedded> external style has a premise: the position of the embedded css style must be behind the external style.

 

In summary-- Proximity principle (the closer the element to be set, the higher the priority level).

However, note that the priorities summarized above have one premise: the css styles in inline, embedded, and external style tables share the same weights.

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.