一个超级变态的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>