小白教程
所有教程
关于
Search
108.162.216.107
108.162.216.107
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Sel attr begin”的源代码
本页内容
上一节:
Sel_gen_sibling
下一节:
Sel_attr_end
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:[attribute^=value]}}[[Category:css selectors|25]] = 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> <style> div[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.</p> </body> </html> </run> == 定义和用法 == The [attribute^=value] 选择器匹配元素属性值带指定的值开始的元素。 == 浏览器支持 == 所有主流浏览器都支持[attribute^=value] 选择器。 '''注意:''' [attribute^=value]在IE8中运行,必须声明[[tag doctype|<!DOCTYPE>]] == 更多实例 == 设置class属性值以"test"开头的所有元素的背景颜色: <sample title="" desc="" lang="html" hererun="1"> [class^="test"] { background:#ffff00; } </sample> <run name=""> <html><!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.</p> </body> </html> </run> [[css selectors|完整CSS选择器参考手册]]
返回至“
Sel attr begin
”。
上一节:
Sel_gen_sibling
下一节:
Sel_attr_end