css选择器笔记

p.important {color:red;}  选择器现在会匹配 class 属性包含 important 的所有 p 元素

我们假设 class 为 important 的所有元素都是粗体,而 class 为 warning 的所有元素为斜体,class 中同时包含 important 和 warning 的所有元素还有一个银色的背景 。就可以写作:

.important {font-weight:bold;}
.warning {font-style:italic;}
.important.warning {background:silver;}

后代选择器:也叫包含选择器
h1 em {color:red;} h1下面的em
.mytop .topinner{height:681px; 997px;margin:0 auto;} mytop下面的 topinner 最终topinner被选择
 
原文地址:https://www.cnblogs.com/as3lib/p/4511669.html