源代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>编程字典</title> <style> a[target] { background-color: yellow; } </style> </head> <body> <p>这个链接使用target属性,设置一个黄色背景:</p> <a href="#">编程字典</a> <a href="#" target="_blank">百度</a> <a href="#" target="_top">阿里</a> <p><b>注意:</b> [<i>attribute</i>] 要想在 IE8 和更早的版本工作, DOCTYPE必须声明.</p> </body> </html>
运行结果