优先级别排序
~~~
<div class='test' id='first'>hello world</div>
~~~
~~~
元素选择器<class选择器<ID选择器<!important
div{color:pink}<div.test{color:blue}<div#first{color:yellow}<div{color:red !important}
~~~
权重
~~~
<div class="parent">
<div class="child">child</div>
</div>
~~~
~~~
/* 选择器嵌套的层次越深,那么权重越高 */
.child{
color:red;
}
.parent>.child{
color:green;
}
~~~