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

CSS——选择器

时间:2016-07-12 21:29:51      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:

1.标签选择器

<style type="text/css">
h1{
    font-weight:normal;   
    color:red;
}    
</style>

2.类选择器  .

<style type="text/css">
.stress{
    color:red;
}
</style>

3.id选择器 #

<style type="text/css">
#stress{
    color:red;
}
</style>

4.子选择器 >

<style type="text/css">
.food>li{border:1px solid red;}
.first>span{border:1px solid red;}
</style>

5.包含(后代选择器)  空格

<style type="text/css">
.first span{color:red;}
</style>

6.通用选择器  *

<style type="text/css">
* {color:red;
   font-size:20px;
    }
</style>

7.伪类选择符  :

<style type="text/css">
a:hover{
    color:red;
    font-size:20px;
}
</style> 

8.分组选择符(多个元素同时设置)  ,

<style type="text/css">
h1,span{color:red;}
.first,span{color:green;}
</style>  

CSS——选择器

标签:

原文地址:http://www.cnblogs.com/congyue-pepsi/p/5664798.html

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