您的位置:首页 > 其它

伪类的其他标签: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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息