Sie sind auf Seite 1von 2

CSS Reference

http://www.w3schools.com/cssref/css_selectors.asp

CSS Selectors
In CSS, selectors are patterns used to select the element(s) you want to style. The "CSS" column indicates in which CSS version the property is defined (CSS1, CSS2, or CSS ). Selector .class "id # element element,element element element element%element element&element Example .intro "firstname # p div,p div p div%p div&p Example description Selects all elements with class!"intro" Selects the element with id!"firstname" Selects all elements Selects all $p% elements Selects all $div% elements and all $p% elements Selects all $p% elements inside $div% elements Selects all $p% elements where the parent is a $div% element Selects all $p% elements that are placed immediately after $div% elements Selects all elements with a tar)et attri*ute Selects all elements with tar)et!"+*lan," Selects all elements with a title attri*ute containin) the word "flower" Selects all elements with a lan) attri*ute value startin) with "en" Selects all unvisited lin,s Selects all visited lin,s Selects the active lin, Selects lin,s on mouse over Selects the input element which has focus Selects the first letter of every $p% element Selects the first line of every $p% element Selects every $p% element that is the first child of its parent Insert content *efore the content of every $p% element Insert content after every $p% element Selects every $p% element with a lan) attri*ute e1ual to "it" (Italian) Selects every $ul% element that are preceded *y a $p% element Selects every $a% element whose src attri*ute value *e)ins with "https" Selects every $a% element whose src attri*ute value ends with ".pdf" CSS 1 1 2 1 1 1 2 2

'attribute( 'attribute! value( 'attribute-!value(

'tar)et( 'tar)et!+*lan,( 'title-!flower(

2 2 2

'attribute.! value(

'lan).!en(

/lin, /visited /active /hover /focus /first0letter /first0line /first0child /*efore /after /lan)(language)

a/lin, a/visited a/active a/hover input/focus p/first0letter p/first0line p/first0child p/*efore p/after p/lan)(it)

1 1 1 1 2 1 1 2 2 2 2

element1-element2

p-ul

'attribute2!value(

a'src2!"https"(

'attribute3! value(

a'src3!".pdf"(

'attribute#! value(

a'src#!"w schools"( Selects every $a% element whose src attri*ute value contains the su*strin) "w schools" p/first0of0type Selects every $p% element that is the first $p% element of its parent Selects every $p% element that is the last $p% element of its parent Selects every $p% element that is the only $p% element of its parent Selects every $p% element that is the only child of its parent Selects every $p% element that is the second child of its parent Selects every $p% element that is the second child of its parent, countin) from the last child Selects every $p% element that is the second $p% element of its parent Selects every $p% element that is the second $p% element of its parent, countin) from the last child Selects every $p% element that is the last child of its parent Selects the document4s root element Selects every $p% element that has no children (includin) te5t nodes)

/first0of0type

/last0of0type

p/last0of0type

/only0of0type

p/only0of0type

/only0child /nth0child(n) /nth0last0child(n)

p/only0child p/nth0child(2) p/nth0last0child(2)

/nth0of0type(n)

p/nth0of0type(2)

/nth0last0of0type(n)

p/nth0last0of0 type(2) p/last0child /root p/empty

/last0child /root /empty

1 de 2

29/08/2013 20:36

CSS Reference

http://www.w3schools.com/cssref/css_selectors.asp

/root /empty

/root p/empty

Selects the document4s root element Selects every $p% element that has no children (includin) te5t nodes) Selects the current active "news element (clic,ed on a 678 containin) that anchor name) Selects every ena*led $input% element Selects every disa*led $input% element Selects every chec,ed $input% element Selects every element that is not a $p% element Selects the portion of an element that is selected *y a user

/tar)et

"news/tar)et

/ena*led /disa*led /chec,ed /not(selector) //selection

input/ena*led input/disa*led input/chec,ed /not(p) //selection

2 de 2

29/08/2013 20:36

Das könnte Ihnen auch gefallen