Selectors
CSS selector examples
/* Tag. */
p { ... }
/* Id. */
#wt-wish-list { ... }
/* Class. */
.wt-wish { ... }
/* Multiple criteria: Tag with a specific class. */
p.wt-bold { ... }
/* Factorization: Apply same style to multiple selectors. */
p, #wt-wish-list, .wt-wish { ... }
/* Child element: Apply style to every button which is contained in an element with a "wt-button-container" class. */
.wt-button-container button { ... }
/* Direct child element. */
.wt-button-container > button { ... }
/* Pseudo-classes. */
.wt-button-container:hover { ... }
.wt-button-container:first-child { ... }
Prefer using class-based selectors.
Pseudo-classes
Pseudo-classes allow you to customize the CSS depending on the context or state of the element (e.g.: is it the first element of a list, is it a checked checkbox etc...).
Last updated