首页 > Web开发 > 详细

CSS——选择器

时间:2016-07-12 21:29:15      阅读:280      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!