码迷,mamicode.com
首页 > Web开发 > 详细

css选择器笔记

时间:2015-05-18 14:30:49      阅读:145      评论:0      收藏:0      [点我收藏+]

标签:

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; width:997px;margin:0 auto;} mytop下面的 topinner 最终topinner被选择
 

css选择器笔记

标签:

原文地址:http://www.cnblogs.com/as3lib/p/4511669.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!