Below are the CSS selectors supported by Prince. For their precise definition please refer to the CSS specification - Prince largely implements Selectors Level 4.
selector |
Can refer to a simple selector , compound selector ,
complex selector , or selector list . |
selector list |
A comma-separate list of selectors. |
compound selector |
A chain of simple selectors that are not separated by a combinator. |
simple selector |
Either a type selector, universal selector, attribute selector, class selector,
ID selector, or pseudo-class. |
relative selector |
A shorthand for selectors that represent elements relative to a :scope
element. |
combinator |
Punctuation that represents a particular kind of relationship between compound
selectors on either side. |
An+B |
This micro-syntax to indicate indexes in a list of sibling elements represents
an integer step (A) and offset (B) , i.e. it indicates the
An+B th elements in a list. It also takes the keywords odd
and even . |
expanded element name |
The tuple of local element name and namespace name. |
Type (tag name) selectors |
E |
A type selector representing an element E in the default namespace. |
|E |
A type selector representing an element E in no namespace. |
ns|E |
A type selector representing an element E in the namespace ns . |
*|E |
A type selector representing an element E in any or no namespace. |
Universal selectors |
* |
A universal selector representing all elements in the default namespace. |
|* |
A universal selector representing all elements in no namespace. |
ns|* |
A type selector representing all elements in the namespace ns . |
*|* |
A type selector representing all elements. |
Case-sensitivity of the attributes and values depends on the document language. To match values case-insensitively, the attribute selector may contain the identifier i
before the closing bracket. (Example: [att=val i]
)
Default namespaces do not apply to attributes. Therefore a namespace ns
that has been previously declared should be added before the namespace separator |
preceding the attribute name.
Attribute presence and value selectors |
[att] |
An attribute selector representing an element with the att attribute. |
[att=val] |
An attribute selector representing an element with the att attribute
with the value val . |
[att~=val] |
An attribute selector representing an element with the att attribute
containing the value val . |
[att|=val] |
An attribute selector representing an element with the att attribute
equal to or beginning with the value val . |
Substring matching attribute selectors |
[att^=val] |
An attribute selector representing an element with the att attribute
whose value begins with the prefix val . |
[att$=val] |
An attribute selector representing an element with the att attribute
whose value ends with the suffix val . |
[att*=val] |
An attribute selector representing an element with the att attribute
whose value contains val . |
Class selectors |
E.val |
A class selector representing an element E with a class identifier
val . |
ID selectors |
E#val |
An ID selector representing an element E with an ID identifier
val . |
The :root pseudo-class |
:root |
The :root pseudo-class represents an element that is the root of
the document. In HTML 4 this is always the HTML element. |
The :empty pseudo-class |
:empty |
The :empty pseudo-class represents an element that has no children
at all. |
The child-indexed pseudo-classes |
:nth-child(An+B of S) |
The :nth-child(An+B) pseudo-class represents the An+B th
element that matches the selector list S among its inclusive siblings. |
:nth-last-child(An+B of S) |
The :nth-last-child(An+B) pseudo-class represents the An+B th
element that matches the selector list S among its inclusive siblings,
counting backwards from the end. |
:first-child |
The :first-child pseudo-class represents an element that is first
among its inclusive siblings. |
:last-child |
The :last-child pseudo-class represents an element that is last
among its inclusive siblings. |
:only-child |
The :only-child pseudo-class represents an element that has no siblings. |
The typed child-indexed pseudo-classes |
:nth-of-type(An+B) |
The :nth-of-type(An+B) pseudo-class represents the An+B th
element with the same namespace and type among its inclusive siblings. |
:nth-last-of-type(An+B) |
The :nth-last-of-type(An+B) pseudo-class represents the An+B th
element with the same namespace and type among its inclusive siblings, counting backwards
from the end. |
:first-of-type |
The :first-of-type pseudo-class represents an element that is the
first with a particular namespace and type among its inclusive siblings. |
:last-of-type |
The :last-of-type pseudo-class represents an element that is the
first with a particular namespace and type among its inclusive siblings, counting
backwards from the end. |
:only-of-type |
The :only-of-type pseudo-class represents an element that has no
siblings with the same namespace and type. |