Explore tens of thousands of sets crafted by our community.
CSS Selectors
31
Flashcards
0/31
.class
Selects all elements with the class attribute matching 'class'.
*
Selects all elements in the document.
[attribute~='value']
Selects elements with an attribute containing the specified word 'value'.
element1:empty
Selects <element1> that have no children (including text nodes).
element1 element2
Selects all <element2> that are descendants of <element1>.
[attribute^='value']
Selects elements with the specified attribute value beginning with 'value'.
element1:focus
Selects <element1> when it has focus.
element1:last-of-type
Selects the last <element1> of its type in its parent element.
element1::after
Generates a pseudo-element after <element1>'s content.
element1 ~ element2
Selects all <element2> that are siblings of <element1>.
element1:hover
Selects <element1> when the mouse pointer is over it.
element1:first-of-type
Selects the first <element1> in its parent element.
element1::before
Generates a pseudo-element before <element1>'s content.
[attribute='value']
Selects all elements with the specified attribute and value matching 'value'.
[attribute*='value']
Selects elements with the specified attribute value containing the substring 'value'.
element1:active
Selects <element1> when it's being activated by the user (e.g., clicked on).
element1:disabled
Selects <element1> when it is disabled.
element1:checked
Selects <element1> when it is checked (for input elements like checkboxes or radio buttons).
#id
Selects the element with the id attribute matching 'id'.
[attribute]
Selects all elements with the specified attribute.
element1:nth-child(n)
Selects <element1> that is the nth child of its parent.
element1:nth-of-type(n)
Selects <element1> that is the nth of its type in its parent element.
div
Selects all <div> elements.
element1 + element2
Selects the first <element2> that is placed immediately after <element1>.
element1:root
Selects the element that is the root of the document.
[attribute
Selects elements with the specified attribute value ending with 'value'.
element1:first-child
Selects <element1> when it is the first child of its parent.
[attribute|='value']
Selects elements with the specified attribute starting with the value 'value' followed by an optional hyphen.
element1:not(selector)
Selects all <element1> that do not match the 'selector'.
element1 > element2
Selects all <element2> that are direct children of <element1>.
element1:last-child
Selects <element1> when it is the last child of its parent.
© Hypatia.Tech. 2024 All rights reserved.