Home > Web Front-end > HTML Tutorial > Reading Notes on CSS Things 1_html/css_WEB-ITnose

Reading Notes on CSS Things 1_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:45:11
Original
1017 people have browsed it

When it comes to selectors, I only know that class selection conforms to the ID selector, but I am not very clear about the priority of the selector. Below, excerpt from the example in the book:

Set the !important keyword statement on the attribute to increase the weight of the attribute. Properties declared with the !important keyword have the highest priority.

  • Tag selectors, pseudo-classes and pseudo-objects: the priority score is 1.
  • Class selector, attribute selector: Priority level points are 10.
  • ID selector: Priority level points are 100.
  • style attribute: Priority points are 1000.
  • Example:

    p{ color:blue; }

    p .myColor{color:black;}

    .myColor{color:yellow;}

    #myColor{color:red;}

    p=1

    p .myColor=1 10=11

    .myColor=10

    #myColor=100

    style="color:green;"=1000

    The color labeling part is easy to make mistakes. I always thought that the color of the second label had a higher priority. .

    Related labels:
    source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template