2
我有兩個CSS表達式:這兩個CSS表達式有什麼區別?
.firstexpression.secondexpression (without space)
和
.firstexpression .secondexpression (with space)
的區別是什麼?
我有兩個CSS表達式:這兩個CSS表達式有什麼區別?
.firstexpression.secondexpression (without space)
和
.firstexpression .secondexpression (with space)
的區別是什麼?
第一適用於具有施加,第二個的子元素與.secondexpression
與父兩個類元素與.firstexpression
.firstexpression.secondexpression{
/* styles */
}
適用於:
<div class='firstexpression secondexpression'>Applies to this element</div>
Vs的..
.firstexpression .secondexpression{
/* styles */
}
適用於:
<div class='firstexpression'>
<div class='secondexpression'>Applies to this element only</div>
</div>
請參閱:http://stackoverflow.com/questions/10036156/whats-the-difference-between-css-classes-foo-bar-without-space-and-foo-bar,http:// stackoverflow .com/questions/1126338/class-class-class-class-class-class-in-css,http://stackoverflow.com/questions/14763313/whats-the-difference-between-these-two-css -selectors?RQ = 1 –