css权重问题

css优先级权重问题

1.style :1000

2.id :100

3.类 .class,属性选择器[class="paragraph"]和伪类 :first-child :last-of-fype等等 :10

4.类型选择器 div a p ul等等和伪元素选择器a:hover,a:link等等:1

5.特殊的 同一组属性设置中标有“!important”规则的优先级最大

例如 
#content div#main-content h2 100+1+100+1=202

#main-content [class="paragraph"] h2  100+10+1=111

猜你喜欢

转载自www.cnblogs.com/whyue/p/8985028.html