css選取器:CSS選取器基礎筆記

來源:互聯網
上載者:User

css selectors
1)[attribute] base on attribute
a[href] { text-decoration: none; }
2)[attribute=val] base on the value of an attribute
a[href="www.cxybl.com"]{ text-decoration: none; }
3)[attribute~=val] contain the space-separated attribute somewhere in the value
a[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 value
a[title="apple"] { color: red; }
/* <a title="apple-banana">link</a> */
css3
1)[attribute^=val] attribute’s value begins with val
a[href^="mailto:"] { color: red; }
2)[attribute$=val] attribute’s value ends with val
a[href$='.rss'] { color: red; }
3)[attribute*=val] attribute value is anywhere within val
a[href *="username"] { color: red; } 本文連結http://www.cxybl.com/html/wyzz/CSS/20120708/31756.html

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.