zoukankan      html  css  js  c++  java
  • Css选择器的优先级

    a = 行内样式style。

    b = ID选择器的数量。

    c = 类、伪类和属性选择器的数量。

    d = 类型选择器和伪元素选择器的数量。

    选择器等级(a,b,c,d)
    style=”” 1,0,0,0
    #wrapper #content {} 0,2,0,0
    #content .dateposted {} 0,1,1,0
    div#content {} 0,1,0,1
    #content p {} 0,1,0,1
    #content {} 0,1,0,0
    p.comment .dateposted {} 0,0,2,1
    div.comment p {} 0,0,1,2
    .comment p {} 0,0,1,1
    p.comment {} 0,0,1,1
    .comment {} 0,0,1,0
    div p {} 0,0,0,2
    p {} 0,0,0,1

     简单的理解为选择器的指向范围越小, 优先级越高.

  • 相关阅读:
    HDU 4005 The war
    #undef
    [转载] #define new DEBUG_NEW
    [转载]常用正则表达式
    [百科]
    [转载]
    [转载]
    [转载]
    [百科]
    [转载]VC6中的文件后缀
  • 原文地址:https://www.cnblogs.com/answercard/p/4241766.html
Copyright © 2011-2022 走看看