伪类的其他标签:first-letter,first-line、::selection、nth-child
2018-03-22 17:53
429 查看
<!-- 其他伪类的学习
1、:first-letter标签里的第一个字
2、:first-line标签里的第一排字
3、::selection 选中的状态
4、:nth-child()第几个元素的样式-->
<!DOCTYPE html>
<html>
<head>
<title>其他伪类</title>
<style type="">
p{
font-size: 16px;
color: #000000;
}
p:first-letter{
font-size: 32px;
color: #ff0004;
}
/*first-line对第一行设置样式*/
p:first-line{
font-size:22px;
font-weight: bold;
}
/*selection就是鼠标选中后的颜色*/
p::selection{
background-color: palevioletred;
}
ul{
width: 100%;
padding: 0;
}
ul li{
width: 100%;
height: 30px;
list-style: none;
background-color: #EBEBEB;
margin-top: 3px;
}
ul li:nth-child(2n){/*2n是偶数行2n+1s是奇数行也可以是单独的数字*/
background-color: aqua;
}
</style>
</head>
<body>
<p>开业第一天的客流大概2800人左右,说实话没有到我们的预期</p>
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</body>
</html>
1、:first-letter标签里的第一个字
2、:first-line标签里的第一排字
3、::selection 选中的状态
4、:nth-child()第几个元素的样式-->
<!DOCTYPE html>
<html>
<head>
<title>其他伪类</title>
<style type="">
p{
font-size: 16px;
color: #000000;
}
p:first-letter{
font-size: 32px;
color: #ff0004;
}
/*first-line对第一行设置样式*/
p:first-line{
font-size:22px;
font-weight: bold;
}
/*selection就是鼠标选中后的颜色*/
p::selection{
background-color: palevioletred;
}
ul{
width: 100%;
padding: 0;
}
ul li{
width: 100%;
height: 30px;
list-style: none;
background-color: #EBEBEB;
margin-top: 3px;
}
ul li:nth-child(2n){/*2n是偶数行2n+1s是奇数行也可以是单独的数字*/
background-color: aqua;
}
</style>
</head>
<body>
<p>开业第一天的客流大概2800人左右,说实话没有到我们的预期</p>
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</body>
</html>
相关文章推荐
- CSS选取第几个标签元素:nth-child(n)、first-child、last-child
- CSS入门之其他伪类,first-child,left,right,lang,focus
- CSS选取第几个标签元素:nth-child、first-child、last-child
- [转]:first-letter和:first-line伪类
- HTML5学习_day13(2)--nth-child(n)伪类选择器(多标签时不通过id,class来快速选中标签)
- HTML5基础加强css样式篇(伪元素first-letter,first-line,selection和css计数函数counter,counters)(十六)
- CSS选取第几个标签元素:nth-child、first-child、last-child
- 伪类的学习first-child标签的三种用法
- CSS3:nth-child()伪类选择器,奇偶数行自定义样式first-child
- CSS中的第一个:first-letter 最后一个:last-child 第n个:nth-child 伪元素
- CSS3伪元素::first-line、::first-letter、 ::Selection
- CSS :first-child 伪类
- CSS3 的 伪类选择器:nth-child()
- CSS中first-child和nth-child的讲解
- HTML5基础加强css样式篇(结构化伪类选择器:nth-child和nth-of-type比较)(十二)
- CSS3 伪类选择器 nth-child() 的用法
- 伪类选择器之结构选择器::noth-child(n)/:nth-of-type(n)
- CSS3:nth-child()伪类选择器,Table表格奇偶数行定义样式
- CSS3---结构性伪类选择器—nth-child(n)
- CSS3 :nth-child()伪类选择器