
一个超级变态的DIV+CSS
1. E[att^="string"] {property: value;} where E is a selector.
最终显示的结果就是:在以P为标签里,只要他的里面包函"ho"那么它的背景就为绿的
CSS:
p[title^="ho"] {background: green;}
HTML:
<p title="home">
This paragraph should have a green background.
</p>
<p title="contact">
The attribute selector doesn’t match this paragraph.
</p>
<p title="house">
This paragraph should have a green background.
</p>
<p>
The attribute selector doesn’t match this paragraph.
</p>
<p title="hot">
This paragraph should have a green background.
</p>
2. E[att$="string"] {property: value;} where E is a selector.
最终显示的结果就是:在以P为标签里,只要他的里面不包函" t ",那么它的背景就为绿的
css:
p[title$="t"] {background: green;}
html:
<p title="home">
The attribute selector doesn’t match this paragraph.
</p>
<p title="contact">
This paragraph should have a green background.
</p>
<p title="house">
The attribute selector doesn’t match this paragraph.
</p>
<p>
The attribute selector doesn’t match this paragraph.
</p>
<p title="hot">
This paragraph should have a green background.
</p>
最终显示的结果就是:在以P为标签里,只要他的里面模糊包函" ont ",那么它的背景就为绿的
css:
p[title*="ont"] {background: green;}
html:
<p title="home">
The attribute selector doesn't match this paragraph.
</p>
<p title="contact">
This paragraph should have a green background.
</p>
<p title="house">
The attribute selector doesn't match this paragraph.
</p>
<p>
The attribute selector doesn't match this paragraph.
</p>
<p title="hot">
The attribute selector doesn't match this paragraph.
</p>
您发布的评论即表示同意遵守以下条款:
一、不得利用本站危害国家安全、泄露国家秘密,不得侵犯国家、社会、集体和公民的合法权益;
二、不得发布国家法律、法规明令禁止的内容;互相尊重,对自己在本站的言论和行为负责;
三、本站对您所发布内容拥有处置权。