CSS中关于多个选择器中是否含有空格的区别
CSS中多个选择器中含有空格和不含有空格区别很大,区分下列含义:
#header.callout { }
#header .callout { }
第一个表示ID为header的同时类名为callout的选择器,
第二个表示ID为header下子节点中含有类名为callout的选择器
我们用以下例子表明:
#header.callout { }
<div id="header" class="callout">
</div>
#header .callout { }
<div id="header" class="callout">
<div class="callout">
</div>
</div>
#header .callout { }中我们选择的是其中的类名为callout的子div。