Universal

*

Matches any element.

Type

E

Matches any E element.

Class

.info

Matches any element whose class attribute contains the value info.

ID

#footer

Matches any element with an id equal to footer.

Descendant

E F

Matches any F element that is a descendant of an E element.

Child

E > F

Matches any F element that is a child of an E element.

Adjacent

E + F

Matches any F element immediately preceded by a sibling element E.

Attribute

E[att]

Matches any E element that has an att attribute, regardless of its value.

Attribute

E[att=val]

Matches any E element whose att attribute value is exactly equal to val.

Attribute

E[att~=val]

Matches any E element whose att attribute value is a list of space-separated values, one of which is exactly equal to val.

Attribute

E[att|=val]

Matches any E element whose att attribute has a hyphen-separated list of values beginning with val.

pseudo-class

E:first-child

Matches element E when E is the first child of its parent.

pseudo-class

E:link
E:visited

Matches not yet visited (:link) or already visited (:visited) links.

dynamic pseudo-class

E:active
E:hover
E:focus

Matches E during certain user actions.

pseudo-class

E:lang(c)

Matches elements of type E that are in language c.

pseudo-element

E:first-line

Matches the contents of the first formatted line of element E.

pseudo-element

E:first-letter

Matches the first letter of element E.

pseudo-element

E:before
E:after

Used to insert generated content before or after an element’s content.


Universal Selector

* {color: purple;}
DIV.danger * {color: red;}
body * UL {color: gray;}
body * * UL {border-right: thin solid green;}

創作者介紹
創作者 Rita 的頭像
Rita

Watermeloner

Rita 發表在 痞客邦 留言(0) 人氣()