读书人

CSS选择器基础札记

发布时间: 2012-09-05 15:19:35 作者: rapoo

CSS选择器基础笔记
CSS selectors

1)[attribute] base on Attributea[href] { text-decoration: none; }2)[attribute=val] base on the Value of an attributea[href="www.iteye.com"]{ text-decoration: none; }3)[attribute~=val] contain the space-separated attribute somewhere in the valuea[title~="tv hd digital"] { text-decoration: none; }/* if title's value contains the word 'tv' or 'hd' or 'digital', then apply the CSS */4)[attribute|=val] contain the attribute with a hyphen, must start with the valuea[title|="apple"] { color: red; }/* <a title="apple-banana">link</a> */CSS31)[attribute^=val] attribute’s value begins with vala[href^="mailto:"] { color: red; }2)[attribute$=val] attribute’s value ends with vala[href$='.rss'] { color: red; }3)[attribute*=val] attribute value is anywhere within vala[href *="username"] { color: red; }

读书人网 >CSS

热点推荐