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

CSS选择器

时间:2017-07-13 16:09:14      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:link   class   鼠标   first   letter   节点   lin   分组   伪类   

元素选择器 也是类型选择器 html {color:black;} h1 {color:blue;} h2 {color:silver;}
 
选择器分组 h2, p {color:gray;}
 
通配符选择器 * {color:red;}
 
CSS 类选择器 <h1 class="important">his heading is very important.</h1> <p class="important">This paragraph is very important.</p>
 
.important {color:red;}
ID选择器 #intro {font-weight:bold;}
属性选择器 *[title] {color:red;}
后代选择器 h1 em {color:red;} h1下面所有的em 无论多深
子元素选择器 h1 > strong {color:red;} h1下一层的strong
相邻兄弟选择器 h1 + p {margin-top:50px;} 必须有同一个父节点
锚伪类 a:link {color: #FF0000} /* 未访问的链接 */ a:visited {color: #00FF00} /* 已访问的链接 */ a:hover {color: #FF00FF} /* 鼠标移动到链接上 */ a:active {color: #0000FF} /* 选定的链接 */
 
p:first-child {font-weight: bold;} p下面的第一个类
 
伪元素 p:first-letter{ font-size:xx-large;}
 

CSS选择器

标签:link   class   鼠标   first   letter   节点   lin   分组   伪类   

原文地址:http://www.cnblogs.com/dxyrain/p/7160399.html

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