实例首页
自学教程
IT工具箱
源代码
下载代码
上下布局
点击运行 >
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>CSS 属性包含值选择器 实例 - 自学教程(runoops.com)</title> <style> [title~=flower] { border:5px solid yellow; } </style> </head> <body> <p>图片的 title 属性中如果带有 "flower" 单词,则会设置为黄色边框。</p> <img src="//demo.runoops.com/static/img/klematis_small.jpg" title="klematis flower" width="150" height="113" /> <img src="//demo.runoops.com/static/img/img_flwr.gif" title="flowers" width="224" height="162" /> <img src="//demo.runoops.com/static/img/landscape.jpg" title="landscape" width="160" height="120" /> <p><b>注意:</b>如果 [<i>attribute</i>~=<i>value</i>] 要在 IE8 及其更早版本下起作用, DOCTYPE 是必须声明的。</p> </body> </html>
运行结果: