Friday, March 11, 2016

CSS Selectors Level 3

1. Selector Syntax

Selector

A selector is one or more sequences of simple selectors separated by combinators, an optional pseudo-element may follow the last sequence of simple selectors

selector = sequenceOfSimpleSelectors [combinator1 sequenceOfSimpleSelectors1 ... ] [::pseudoElement]

A sequence of simple selectors

  • it is a chain of simple selectors that are not separated by a combinator
  • it always begins with a type selector or a universal selector. No other type selector or universal selector is allowed in the sequence
  • simple selectors are: type selector, universal selector, attribute selector, class selector, ID selector, pseudo-class.
  • combinators are: whitespace, > "greater-than sign", + "plus sign", ~ "tilde"

The subjects of a selector are the elements of a document tree that are represented by the selector.