Correction status:qualified
Teacher's comments:
代码:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>3.伪类选择器</title> <style type="text/css"> ul { padding: 0; margin: 0; width: 450px; border: 1px dashed #666; padding: 10px 5px; } ul:after { content:''; display: block; clear:both; } li { list-style: none; float: left; width: 40px; height: 40px; line-height: 40px; text-align: center; border-radius: 50%; background: skyblue; margin-right: 5px; } ul li:first-child { background-color: brown; } ul li:last-child { background-color: lightgreen; } p:only-of-type { color:red; } </style> </head> <body> <ul> <li id="item1">1</li> <li class="green">2</li> <li class="green red">3</li> <li class="red">4</li> <li>5</li> <li id="item2">6</li> <li class="php">7</li> <li class="php css">8</li> <li>9</li> <li>10</li> </ul> <div> <p>我是当前div元素中的唯一子元素</p> </div> <div> <p>我是当前div元素中的第一个子元素</p> <p>我是当前div元素中的第二个子元素</p> </div> <div> <p>我虽然是div下唯一的类型为p的子元素</p> <h4>我是div下的另一个子元素h4</h4> </div> </body> </html>
点击 "运行实例" 按钮查看在线实例