日期:2014-05-17  浏览次数:20684 次

CSS选择器优先级问题
html如下
<body>
  <div class="father">
  <div class="son1">Box-1</div>
  <div class="son2">Box-2</div>
  <div class="son3">Box-3<br />Box-3<br />Box-3<br />Box-3</div>
  <div class="clear"></div>
  </div>
 </body>
CSS如下
.father div
  {
  padding:10px;
  margin: 15px;
  border: 1px dashed #111111;
  background-color: #90baff;
  }
 .father .clear
  {
  margin: 0;
  padding: 0;
  border: 0;
  clear: both;
  }

为什么选择器 .father .clear的优先级比.father div高呢?
为什么把.father .clear换成.clear就变成.father div优先了呢?

------解决方案--------------------
http://developer.51cto.com/art/201009/226852.htm