css3 属性选择器
属性选择:
[id=id1]{
background-color:red;
}
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style> [id=id1]{ background-color:red; } [id=id2]{ background-color:green; } [id=id3]{ background-color:blue; } </style> </head> <body> <div id="id1" style="width:200px; height:100px;"> </div> <div id="id2" style="width:200px; height:100px;"> </div> <div id="id3" style="width:200px; height:100px;"> </div> </body> </html>
效果如图: