结构伪类选择器
结构伪类选择器
p:条件
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <!--避免使用,class,id选择器--> <style> /*ul的第一个子元素*/ ul li:first-child{ background: lightpink; } /*ul的最后一个子元素*/ ul li:last-child{ background: cornflowerblue; } /*选中p1 :定位到父元素,选择当前的第一个元素 选中当前p元素的父级元素,选中父级元素的第一个,并且是当前元素才生效,顺序! */ p:nth-child(1){ background: burlywood; } /*选中父元素,下的p元素的第二个,类型*/ p:nth-of-type(2){ background: gold; } /*a:hover{*/ /* background: cadetblue;*/ /*}*/ </style> </head> <body> <!--<a href="">123456</a>--> <!--<h1>111</h1>--> <p>p1</p> <p>p2</p> <p>p3</p> <ul> <li>li1</li> <li>li2</li> <li>li3</li> </ul> </body> </html>
我的一生
第1章-废物的一生
第50章-糟糕的婴儿
第300章-莫欺少年穷
第600章-莫欺中年穷
第1000章-莫欺老年穷
第1100章-不详的离去
第1101章-棺材板的震动
第1150章-盗墓贼的眼泪
第1200章-死者为大