Edit online

CSS Selectors

CSS selectors are used to target elements in an XML document in order to style them. There are a wide variety of CSS selectors available, allowing for fine-grained precision when selecting elements to style.

Edit online

CSS Supported Selectors

The following table summarizes the selectors supported by Oxygen PDF Chemistry:
Pattern Meaning Described in section CSS level
* Any element. Universal selector 2
E An element of type E. Type selector 1
E[foo] An <E> element with the @foo attribute set. Attribute selectors 2
E[foo="bar"] An <E> element whose @foo attribute value is exactly "bar". Attribute selectors 2
E[foo~="bar"] An <E> element whose @foo attribute value is a list of space-separated values, one of which is exactly equal to "bar". Attribute selectors 2
E[foo^="bar"] An <E> element whose @foo attribute value begins exactly with the string "bar". Attribute selectors 3
E[foo$="bar"] An <E> element whose @foo attribute value ends exactly with the string "bar". Attribute selectors 3
E[foo*="bar"] An <E> element whose @foo attribute value contains the substring "bar". Attribute selectors 3
E[lang|="en"] An <E> element whose @lang attribute has a hyphen-separated list of values beginning (from the left) with "en". Attribute selectors 2
E.myclass An <E> element whose @class is equal to "myclass". Class selectors 1
E#myid An <E> element whose @id is equal to "myid". ID selectors 1
Edit online

CSS Pseudo-Classes and Pseudo-Elements

These keywords may be appended to the last sequence of simple selectors in a selector. It is possible to use one or more keywords in a single simple selector.

Pseudo-Classes

Each of these keywords specifies a special state of the selected element(s).

The following table summarizes the pseudo-classes supported by Oxygen PDF Chemistry:
Pattern Meaning Described in section CSS level
E:root An <E> element, root of the document. Structural pseudo-classes 3
E:first-child An <E> element, first child of its parent. Structural pseudo-classes 2
E:last-child An <E> element, last child of its parent. Structural pseudo-classes 3
E:first-of-type An <E> element, first sibling of its type. Structural pseudo-classes 3
E:last-of-type An <E> element, last sibling of its type. Structural pseudo-classes 3
E:only-of-type An <E> element, only sibling of its type. Structural pseudo-classes 3
E:only-child An <E> element, only child of its parent. Structural pseudo-classes 3
E:nth-child(n) An <E> element, the n-th child of its parent. Structural pseudo-classes 3
E:nth-of-type(n) An <E> element, the n-th sibling of its type. Structural pseudo-classes 3
E:empty An <E> element that has no children (including text nodes). Structural pseudo-classes 3
E:lang(c) An <E> element in (human) language "c" (the document language specifies how the language is determined). The :lang() pseudo-class 2
E:has(rs1) An <E> element that has a relative element that matches the rs1 selector (as one of its children), when evaluated with E as the anchor element. The :has() relational pseudo-class 4

Pseudo-Elements

Each of these keywords lets you style a specific part of the selected element(s).

The following table summarizes the pseudo-elements supported by Oxygen PDF Chemistry:
Pattern Meaning Described in section CSS level
E::first-letter The first formatted letter of an <E> element. The ::first-letter pseudo-element 1
E::before Generated content before an <E> element. The ::before pseudo-element 2
E::after(n) Generated content after an <E> element. Setting a value of 1 creates a normal :before. A higher value means the generated content is further from the element. The ::after(n) pseudo-element
E::after Generated content after an <E> element. The ::after pseudo-element 2
E::before(n) Generated content before an <E> element. Setting a value of 1 creates a normal :before. A higher value means the generated content is further from the element. The ::before(n) pseudo-element
E::marker Generated by list items to represent the item’s marker (the bullet or number identifying each item). <E> should include display: list-item. The ::marker pseudo-element 3
Edit online

CSS Combinators

A selector is a chain of one or more sequences of simple selectors that can be separated by combinators. Combining simple selectors gives them a useful relationship to each other and the content location in the document.

The following table summarizes the combinators supported by Oxygen PDF Chemistry:
Pattern Meaning Described in section CSS level
E F An <F> element descendant of an <E> element. Descendant combinator 1
E > F An <F> element child of an <E> element. Child combinator 2
E + F An <F> element immediately preceded by an <E> element. Next-sibling combinator 2
E ~ F An <F> element preceded by an <E> element. Subsequent-sibling combinator 3