Skip to main content

SelectorCSS Syntax to define pattern to match HTMLElement instances (& special states) in document to direct Style Rule

Source: w3c.github.io/csswg

aka CSS-Selector

Simple Selector

CSS Selector to match on single condition

Grouping Selector

Combinator

Pseudo Selector

Pseudo-Element

Selector :: postfix to match part of selected element(s)

Pseudo-Class

Simple Selector : postfix to match special state of selected element(s)

References

  1. Style Rule ↔ Ruleset with Selector & CSS Declaration block

  2. Pseudo-ElementSelector :: postfix to match part of selected element(s)

  3. Descendent SelectorSelector for Descendant Element (rel to other Element)

  4. Adjacent Sibling Selector+ Selector for Sibling Element; E1 + E2 {} where E2 is selector target

  5. General Sibling Selector~ Selector less strict Adjacent Sibling Selector; E1 ~ E2 {} where E2 is selector target

  6. Child Selector\> Selector for direct Child Element

  7. Class Selector.myClass Selector to match any HTMLElement with class attribute

  8. Type SelectorSelector to match all instance by typeof HTMLElement node in Document

  9. Specificity ↔ Weighting Algorithm for Layout engine to choose which competing Selector Style Rule to apply to HTMLElement

  10. List Selector, comma separated list of Selector to share & reuse Style Rule

  11. ID Selector#myID Selector to match single unique Element

  12. Simple SelectorCSS Selector to match on single condition