选择器
来源:互联网 发布:51单片机学完又学什么 编辑:程序博客网 时间:2024/04/26 20:15
1.元素选择器 后代选择器
p{color:red;}
li a{text-decoration:none;}
2.id选择器 类选择器
#nav{color:red;}
.content{color:red;}
注:尽量不要过度使用class selecter。
而是要使用上述四者的结合。
讲一个类选择器或者id选择器应用于他们的祖先元素然后使用后代选择器定位他们。
3.伪类
a:like{color:blue;}
a:visited{color:green;}
*****************
链接伪类,只用于锚点。
a:hover,a:active{color:red;}
tr:hover{color:red;}
input:focus{color:red;}
*****************
动态伪类,理论可以用于所有元素。
4.通用选择器。
*{padding:0;}可以用来对特定元素的所有后代应用样式,或者跳过一级后代。
5.高级选择器(ie6--不支持)
(1)子选择器:选择元素的直接后代。
#nav>li{colorr:ed;}
ie6--对应
#nav li{color:red;}
#nav li *{color:red} (待证实……)
(后代选择器是选择所有的后代元素)
相邻同胞选择器:定位同一个父元素下某个元素之后的元素。
h1 + p{font-weight:bold;}
(2)属性选择器。
根据某个属性是否存在或者属性的值来寻找元素。
<abbr title="Cascading style sheets">CSS</abbr>
可以用 abbr[titile]:{color:red;}
- 选择器
- 选择器
- 选择器
- 选择器
- 选择器
- 选择器
- 选择器
- 选择器
- 选择器
- 选择器
- 选择器
- 选择器
- 选择器
- 选择器(
- $选择器
- 选择器
- 选择器
- 选择器
- Sqlite修复方法(database disk image is malformed)
- 恋爱中LOSER的特征
- jakarta POI
- 关于centos 5.5 程序中编译出现curses.h不存在问题
- 嵌入式Linux Web 编程
- 选择器
- POJ 2230 Watchcow
- IE中 font-family 显示不正常问题
- oracle sql语句
- char 转wchar_t 及wchar_t转char
- spring基础及IOC注入
- CentOS下安装mysql
- 【转】extjs加载json数据动态生成树
- EXEC和sp_executesql 区别