源代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>编程字典</title> <style> [class|=top] { background: yellow; } </style> </head> <body> <h1 class="top-header">欢迎</h1> <p class="top-text">Hello world!</p> <p class="topcontent">你在学CSS?</p> <p><b>注意:</b> 要想 [<i>attribute</i>] 在 IE8 和更早的版本工作, 必须声明DOCTYPE.</p> </body> </html>
运行结果