css_selector实例

1 * { } 0
3 li:first-line { } 2 (one element, one pseudo-element)
5 ul ol+li { } 3 (three elements)
7 ul ol li.red { } 13 (one class, three elements)
9 style=”” 1000 (one inline styling)
11 div p { } 2 (two HTML selectors)
13 div p.sith { } 12 (two HTML selectors and a class selector)
15 body #darkside .sith p { } 112 (HTML selector, id selector, class selector, HTML selector; 1+100+10+1)

实际经验:

1. 使用LVHA定义链接,即link-visited-hover-active,参考[Link Specificity]
2. 如果不是为了兼容浏览器,最好不要使用 !important
3. 使用ID让特性更具体,比如a.high写成 ul#blog li a.high

CSS工具与资 英文好的去看下

CSS Specificity for Poker Players
CSS specificity calculator
Understanding Specificity Tutorial
Cascade Inheritance: Specificity
CSS 2.1 Selectors Explained
CSS Specificity Bugs in IE
CSS Structure and Rules
Specificity


Related Posts
No related posts
优先级 css Specificity
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值