在 CSS3 中,追加了三个属性选择器分别为:
[att*=val] ----内容包含
[att^=val] ----开头匹配
[att$=val] ----结尾匹配
示例:
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> <style> [id*=box]{ background: #75d8ff; } [id^=box]{ background: #ff0000; } [id$=blue]{ background: blue; } </style> </head> <body> 实例1: <div id="box1">sdf</div> <div id="2box">sdf</div> <div id="box3blue">sdf</div> </body> </html>