Correction status:qualified
Teacher's comments:这两天的作业已检查!!
完成的依旧的很不错!!继续保持!!
基本选择器
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>基本选择器</title> <style type="text/css"> .demo { width: 100px; border: 1px; padding: 10px; } ul{ list-style: none; } li { float: left; height: 20px; line-height: 20px; width: 20px; border-radius: 50px; text-align: center; background: yellow; color: green; margin-right: 15px; } #red {color: red} .items{ margin-right: 4px; background-color: pink; } li.back{ background-color: blue; } .active{font-size: 10px;} .first.last{background: black;} ul>li { background-color: orange; } #last + li{ background-color: purple; } </style> </head> <body> <div class="demo"> <ul > <li id="red" class="first">1</li> <li class="active back">2</li> <li class="back items">3</li> <li class="back">4</li> <li class="items active">5</li> <li id="green" class="second"><h2>6</h2></li> <li style="color:grey">7</li> <li><a href=""><em>8</em></a></li> <li id="last"><strong>9</strong></li> <li >10</li> </ul> </div> </body> </html>
点击 "运行实例" 按钮查看在线实例
属性选择器
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>属性选择器</title> <style type="text/css"> .demo { width: 100px; border: 1px; padding: 10px; } ul{ list-style: none; } li { float: left; height: 20px; line-height: 20px; width: 20px; border-radius: 50px; text-align: center; background: yellow; color: green; margin-right: 15px; } #red {color: red} .items{ margin-right: 4px; background-color: pink; } li.back{ background-color: blue; } .active{ font-size: 10px; } *[id] { background-color: black; } ul>li { background-color: orange; } #last + li{ background-color: purple; } li[class ~="item"] { background-color: black; } li[class ="item"] { background-color: beige; } </style> </head> <body> <div class="demo"> <ul > <li id="red" class="first">1</li> <li class="active back">2</li> <li class="back items">3</li> <li class="back">4</li> <li class="items active">5</li> <li id="green" class="second"><h2>6</h2></li> <li style="color:grey">7</li> <li><a href=""><em>8</em></a></li> <li id="last"><strong>9</strong></li> <li >10</li> </ul> </div> </body> </html>
点击 "运行实例" 按钮查看在线实例