样式优先级

<style>
    #cid{
       color:red;
}
    .cclass1{
        color:green !important;
}
    .cclass2{
        color;blue;
}    
</style>    

<p id="cid" class="cclass1 cclass2" style="color:black">cat</p>

优先级顺序:

  1. 行内样式>id>class
  2. 只有class存在时(排除!important存在),cclass2会覆盖cclass1
  3. 最高级:带有!important
posted @ 2016-07-06 13:06  夏目233  阅读(128)  评论(0编辑  收藏  举报