小白教程
所有教程
关于
Search
172.70.179.112
172.70.179.112
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Sel attr contain”的源代码
本页内容
上一节:
Sel_attr_end
下一节:
Sel_first_of_type
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:[attribute*=value]}}[[Category:css selectors|27]] = CSS3 [attribute*=value] 选择器 = [[css selectors|完整CSS选择器参考手册]] 设置class属性值包含"test"的所有div元素的背景颜色: <sample title="" desc="" lang="html" hererun="1"> div[class*="test"] { background:#ffff00; } </sample> <run name=""> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>小白教程(xiaobai.wang)</title> <style> div[class*="test"] { background:#ffff00; } </style> </head> <body> <div class="first_test">这是第一个 div 元素。</div> <div class="second">这是第二个 div 元素。</div> <div class="test">这是第三个 div 元素。</div> <p class="test">这是段落中的文本。</p> </body> </html> </run> == 定义和用法 == [attribute*=value] 选择器匹配元素属性值包含指定值的元素。 == 浏览器支持 == 所有主流浏览器都支持[attribute*=value] s选择器。 '''注意:''' [attribute*=value]在IE8中运行,必须声明 [[tag doctype|<!DOCTYPE>]] 。 == 更多实例 == 设置class属性值包含"test"的所有元素的背景颜色: <sample title="" desc="" lang="html" hererun="1"> [class*="test"] { background:#ffff00; } </sample> <run name=""> <!DOCTYPE html> <html> <head> <style> [class*="test"] { background:#ffff00; } </style> </head> <body> <div class="first_test">The first div element.</div> <div class="second">The second div element.</div> <div class="test">The third div element.</div> <p class="test">This is some text in a paragraph.</div> </body> </html> </run> [[css selectors|完整CSS选择器参考手册]]
返回至“
Sel attr contain
”。
上一节:
Sel_attr_end
下一节:
Sel_first_of_type