CSS – Selectors

Below is a common list of selectors. Selector is a pattern that is used to select an element or elements

SelectorDescriptionExample
*Select all the elements*
ELEMENTSelect all ELEMENT elementsdiv
ELEMENT1 ELEMENT2Select any ELEMENT2 element that is descendant of ELEMENT1div p
ELEMENT1,ELEMENT2Select all ELEMENT1 and ELEMENT2 elementsdiv, p
ELEMENT1>ELEMENT2Select any ELEMENT2 that is a child of ELEMENT1div > p
ELEMENT1 + ELEMENT2Select any ELEMENT2 that is immediately after ELEMENT1div + p
#IDSelect the element that has ID equal to ID#myDiv
.CLASSSelect any element that has class equal to CLASS.MyClass
[ATTR]Select any element with the ATTR attribute set[href]
[ATTR=VALUE]Select any element with the ATTR attribute set to VALUE[target=_blank]

You can read more here.

css selectors, <span>CSS – Selectors</span>, KandZ
92160cookie-checkCSS – SelectorsCSS – Selectors

Related posts

One Thought to “CSS – Selectors

Comments are closed.