今天是第五天在PHP中文网学习!
代码:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>选择器</title> <style type="text/css"> ul {padding: 0;margin: 0;} /*元素类选择器*/ #open { color:red; } /*id选择器*/ .two {color:blue;} /*类选择器*/ ul li{background: lightblue;} /*父子选择器*/ dl>dt{color:#FF8EFF ;} /*子元素选择器*/ *[id]{background: #7AFEC6;} /*根据属性名来选择*/ li[class=three]{color: #D26900;}/*根据属性名和值来选择*/ li[class="white"]{color:#F9F900;} /*根据属性中指定单词选择*/ li[class *="tg"]{color: #D9006C;} / *属性中单词在中间的样式*/ </style> </head> <body> <ul> <li id="open">一个鱼</li> <li>两个鱼</li> <li>三个鱼</li> <li>四个鱼</li> <li>五个鱼</li> <li id="six">六个鱼</li> <li>七个鱼</li> </ul> <dl> <dt>八个鱼</dt> <dt>九个鱼</dt> <dd>十个鱼</dd> </ul> </body> </html>
手写代码: