MENU service case
 Website construction website design Beijing website construction high-end website production company Shangpin China
We create by embracing change
360 ° brand value__
simplified Chinese character
Simplified Chinese English

Shangpin China Joins Hands with Beisheng Internet to Create a New Chapter in Website Construction

Type: Shangpin Dynamic Learn more

CSS style priority issue

Source: Shangpin China | Type: website encyclopedia | Time: August 4, 2014
Because there are three different ways to import style sheets and a wide variety of style selectors, it is inevitable that there are duplicate definitions in the definition of the CSS style. For browsers, we need to consider which definition should be executed first. stay Beijing website construction In CSS design, style first should not be ignored.

Orthographic priority

From the position where styles are written, their priorities are:
In line style sheet.
Internal style sheet.
External style sheet.
That is to say, under the same CSS definition, the style defined in the XHTML tag using style must have priority over the style written in the The second or last step is to call and apply external style sheets.

Selector priority

For id and class, the definition of id takes precedence over that of class. For example:
{... Text...}

When two selectors are defined at the same time, for example:

#layout {
background-color:blue;
}
.mylayout{
Background-color:red;
}

The div will execute the definition in the id, that is, the background color is blue. The priority of having a class attribute is greater than that of not having a class attribute, such as the following CSS definitions:
.mylayout{
    background-color:red;
}
div{
   background-color:green;
}

The div will execute the definition in the class, that is, the background color is red. From the priority of selectors: id>class>type selectors. Selector priority can help us optimize CSS definition code.
div{
background-color:green;
}
div#news{
background-color:black;
}
The background color of all divs is green, but the background color of news is black. In this way, individual special cases can be designed separately under most of the same conditions.
Source Statement: This article is original or edited by Shangpin China's editors. If it needs to be reproduced, please indicate that it is from Shangpin China. The above contents (including pictures and words) are from the Internet. If there is any infringement, please contact us in time (010-60259772).
TAG label:

What if your website can increase the number of conversions and improve customer satisfaction?

Make an appointment with a professional consultant to communicate!

* Shangpin professional consultant will contact you as soon as possible

Disclaimer

Thank you very much for visiting our website. Please read all the terms of this statement carefully before you use this website.

1. Part of the content of this site comes from the network, and the copyright of some articles and pictures involved belongs to the original author. The reprint of this site is for everyone to learn and exchange, and should not be used for any commercial activities.

2. This website does not assume any form of loss or injury caused by users to themselves and others due to the use of these resources.

3. For issues not covered in this statement, please refer to relevant national laws and regulations. In case of conflict between this statement and national laws and regulations, the national laws and regulations shall prevail.

4. If it infringes your legitimate rights and interests, please contact us in time, and we will delete the relevant content at the first time!

Contact: 010-60259772
E-mail: [email protected]

Communicate with professional consultants now!

  • National Service Hotline

    400-700-4979

  • Beijing Service Hotline

    010-60259772

Please be assured to fill in the information protection
Online consultation

Disclaimer

Thank you very much for visiting our website. Please read all the terms of this statement carefully before you use this website.

1. Part of the content of this site comes from the network, and the copyright of some articles and pictures involved belongs to the original author. The reprint of this site is for everyone to learn and exchange, and should not be used for any commercial activities.

2. This website does not assume any form of loss or injury caused by users to themselves and others due to the use of these resources.

3. For issues not covered in this statement, please refer to relevant national laws and regulations. In case of conflict between this statement and national laws and regulations, the national laws and regulations shall prevail.

4. If it infringes your legitimate rights and interests, please contact us in time, and we will delete the relevant content at the first time!

Contact: 010-60259772
E-mail: [email protected]