Open bertfrees opened 9 years ago
This is an overview of the selectors that have been tested and work with the existing implementations:
Category | Pattern | Matches |
---|---|---|
Universal selector | * | any element |
Type selectors | E | any element E |
Descendant selectors | E F | any element F that is a descendant of element E |
Child selectors | E > F | any element F that is a child of element E |
Adjacent selectors | E + F | any element F immediately preceded by a sibling element E |
Attribute selectors | E[foo] | any element E with a "foo" attribute |
[foo] | *[foo] | |
E[foo="bar"] | any element E whose "foo" attribute value is "bar" | |
E[foo~="bar"] | any element E whose "foo" attribute is a list of space-separated values, one of which is equal to "bar" | |
E[foo="bar"] | any element E whose "foo" attribute has a hyphen-separated list of values beginning with "bar" | |
Class selectors | E.bar | E[class~="bar"] |
.bar | *.bar | |
ID selectors | E#bar | any element E with ID equal to "bar" |
#bar | *#bar | |
Pseudo-classes | E:first-child | any element E that is the first child of its parent |
E:last-child | any element E that is the last child of its parent | |
E:nth-child(n) | any element E that is the nth child of its parent | |
E:only-child | any element E that has no siblings |
Additional selectors:
:not()
: negation pseudo-class: https://github.com/snaekobbi/braille-css/issues/8:has()
: relational pseudo-class (CSS4): https://github.com/snaekobbi/braille-css/issues/14
Add a section about selectors.
See