# CSS Pseudo-Elements Module Level 4

## Editor’s Draft, 1 January 1970

Specification Metadata

This version:
  https://drafts.csswg.org/css-pseudo-4/
Latest published version:
  https://www.w3.org/TR/css-pseudo-4/
Previous Versions:
  https://www.w3.org/TR/2016/WD-css-pseudo-4-20160607/
  https://www.w3.org/TR/2015/WD-css-pseudo-4-20150115/
Test Suite:
  http://test.csswg.org/suites/css-pseudo-4_dev/nightly-unstable/
Editors:
  Daniel Glazman (Disruptive Innovations)
  Elika J. Etemad / fantasai (Invited Expert)
  Alan Stearns (Adobe Systems Inc.)
Issue Tracking:
  GitHub Issues
Suggest an Edit for this Spec:
  GitHub Editor
Issues List:
  Tracked in Editor’s Draft

Copyright © 1970 W3C® (MIT, ERCIM, Keio, Beihang). W3C liability, trademark and permissive document license rules apply.

## Abstract

This CSS module defines pseudo-elements, abstract elements that represent portions of the CSS render tree that can be selected and styled.

CSS is a language for describing the rendering of structured documents (such as HTML and XML) on screen, on paper, etc.

## Status of this document

This is a public copy of the editors’ draft. It is provided for discussion only and may change at any moment. Its publication here does not imply endorsement of its contents by W3C. Don’t cite this document other than as work in progress.

GitHub Issues are preferred for discussion of this specification. When filing an issue, please put the text “css-pseudo” in the title, preferably like this: “[css-pseudo] …summary of comment…”. All issues and comments are archived, and there is also a historical archive.

This document was produced by the CSS Working Group.

This document was produced by a group operating under the W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

This document is governed by the 1 March 2019 W3C Process Document.

## 1. Introduction

This section is informative.

Pseudo-elements represent abstract elements of the document beyond those elements explicitly created by the document language. Since they are not restricted to fitting into the document tree, they can be used to select and style portions of the document that do not necessarily map to the document’s tree structure. For instance, the ::first-line pseudo-element can select content on the first formatted line of an element after text wrapping, allowing just that line to be styled differently from the rest of the paragraph.

Each pseudo-element is associated with an originating element and has syntax of the form ::name-of-pseudo. This module defines the pseudo-elements that exist in CSS and how they can be styled. For more information on pseudo-elements in general, and on their syntax and interaction with other selectors, see [SELECTORS-4].

## 2. Typographic Pseudo-elements

### 2.1. The ::first-line pseudo-element

The ::first-line pseudo-element describes the contents of the first formatted line of its originating element.

The rule below means “change the letters of the first line of every `p` element to uppercase”:

    p::first-line { text-transform: uppercase }

The selector p::first-line does not match any real document element. It does match a pseudo-element that conforming user agents will insert at the beginning of every `p` element.

Note: Note that the length of the first line depends on a number of factors, including the width of the page, the font size, etc.

For example, given an ordinary HTML [HTML5] paragraph such as:

    <P>This is a somewhat long HTML
    paragraph that will be broken into several
    lines. The first line will be identified
    by a fictional tag sequence. The other lines
    will be treated as ordinary lines in the
    paragraph.</P>

The lines might be broken as follows:

    THIS IS A SOMEWHAT LONG HTML PARAGRAPH THAT
    will be broken into several lines. The first
    line will be identified by a fictional tag
    sequence. The other lines will be treated as
    ordinary lines in the paragraph.

This paragraph might be “rewritten” by user agents to include a fictional tag sequence to represent ::first-line. This fictional tag sequence helps to show how properties are inherited.

    <P><P::first-line> This is a somewhat long HTML
    paragraph that </P::first-line> will be broken into several
    lines. The first line will be identified
    by a fictional tag sequence. The other lines
    will be treated as ordinary lines in the
    paragraph.</P>

If a pseudo-element breaks up a real element, the desired effect can often be described by a fictional tag sequence that closes and then re-opens the element.

Thus, if we mark up the previous paragraph with a `span` element encompassing the first sentence:

    <P><SPAN class="test"> This is a somewhat long HTML
    paragraph that will be broken into several
    lines.</SPAN> The first line will be identified
    by a fictional tag sequence. The other lines
    will be treated as ordinary lines in the
    paragraph.</P>

the user agent could simulate start and end tags for `span` when inserting the fictional tag sequence for ::first-line to get the correct inheritance behavior.

    <P><P::first-line><SPAN class="test"> This is a somewhat long HTML
    paragraph that will </SPAN></P::first-line><SPAN class="test"> be broken into several
    lines.</SPAN> The first line will be identified
    by a fictional tag sequence. The other lines
    will be treated as ordinary lines in the
    paragraph.</P>

#### 2.1.1. Finding the First Formatted Line

In CSS, the ::first-line pseudo-element can only have an effect when attached to a block container. The first formatted line of an element must occur inside a block-level descendant in the same flow (i.e., a block-level descendant that is not out-of-flow due to floating or positioning).

For example, the first line of the `DIV` in `<DIV><P>This line...</P></DIV>` is the first line of the `P` (assuming that both `P` and `DIV` are blocks).

The first line of a table-cell or inline-block cannot be the first formatted line of an ancestor element. Thus, in `<DIV><P STYLE="display: inline-block">Hello<BR>Goodbye</P> etcetera</DIV>` the first formatted line of the `DIV` is not the line "Hello".

Note: Note that the first line of the `p` in this fragment: `<p><br>First...` doesn’t contain any letters (assuming the default style for `br`). The word "First" is not on the first formatted line.

A user agent must act as if the fictional start tags of a ::first-line pseudo-element were nested just inside the innermost enclosing block-level element.

For example, the fictional tag sequence for

    <DIV>
      <P>First paragraph</P>
      <P>Second paragraph</P>
    </DIV>

is

    <DIV>
      <P><DIV::first-line><P::first-line>First paragraph</P::first-line></DIV::first-line></P>
      <P><P::first-line>Second paragraph</P::first-line></P>
    </DIV>

#### 2.1.2. Styling the First Line Pseudo-element

The ::first-line pseudo-element’s generated box behaves similar to that of an inline-level element, but with certain restrictions. The following CSS properties apply to a ::first-line pseudo-element:

- all font properties (see [CSS-FONTS-3])
- the color and opacity properties (see [CSS-COLOR-3])
- all background properties (see [CSS-BACKGROUNDS-3])
- any typesetting properties that apply to inline elements (see [CSS-TEXT-3])
- all text decoration properties (see [CSS-TEXT-DECOR-3])
- the ruby-position property (see [CSS-RUBY-1])
- any inline layout properties that apply to inline elements (see [CSS-INLINE-3])
- any other properties defined to apply to ::first-line by their respective specifications

User agents may apply other properties as well.

#### 2.1.3. Inheritance and the ::first-line Pseudo-element

During CSS inheritance, the portion of a child element that occurs on the first line only inherits properties applicable to the ::first-line pseudo-element from the ::first-line pseudo-element. For all other properties inheritance is from the non-pseudo-element parent of the first line pseudo element. (The portion of a child element that does not occur on the first line always inherits from the parent of that child.)

### 2.2. The ::first-letter pseudo-element

The ::first-letter pseudo-element represents the first typographic letter unit [CSS-TEXT-3] on the first formatted line of its originating element, if it is not preceded by any other content (such as images or inline tables) on its line. The ::first-letter pseudo-element can be used to create “initial caps” and “drop caps”, which are common typographic effects.

For example, the following rule creates a 2-line drop-letter on every paragraph following a level-2 header, using the initial-letter property defined in [CSS-INLINE-3]:

    h2 + p::first-letter { initial-letter: 2; }

Punctuation (i.e, characters that belong to the Punctuation (`P*`) Unicode general category [UAX44]) that precedes or follows the first typographic letter unit must also be included in the ::first-letter pseudo-element.

As explained in [CSS-TEXT-3], a typographic letter unit can include more than one Unicode codepoint. For example, combining characters must be kept with their base character. Also, languages may have additional rules about how to treat certain letter combinations. In Dutch, for example, if the letter combination "ij" appears at the beginning of an element, both letters should be considered within the ::first-letter pseudo-element. [UAX29] The UA should tailor its definition of typographic letter unit to reflect the first-letter traditions of the ::first-letter pseudo-element’s containing block’s content language.

Note: Note that the first typographic letter unit may in fact be a digit, e.g., the “6” in “67 million dollars is a lot of money.”

If the characters that would form the ::first-letter are not in the same element, such as `‘T` in `<p>‘<em>T...`, the user agent may create a ::first-letter pseudo-element from one of the elements, both elements, or simply not create a pseudo-element. Additionally, if the first letter(s) of the block are not at the start of the line (for example due to bidirectional reordering), then the user agent need not create the pseudo-element(s).

The ::first-letter pseudo-element is contained within any ::first-line pseudo-elements, and thus inherits from ::first-line.

#### 2.2.1. Finding the First Letter

The first letter must occur on the first formatted line. For example, in this HTML fragment: `<p><br>First...` the first line doesn’t contain any letters and ::first-letter doesn’t match anything. In particular, it does not match the “F” of “First”.

In CSS, the ::first-letter pseudo-element only applies to block containers. A future version of this specification may allow this pseudo-element to apply to more display types. The ::first-letter pseudo-element can be used with all such elements that contain text, or that have a descendant in the same flow that contains text. A user agent should act as if the fictional start tag of the ::first-letter pseudo-element is just before the first text of the element, even if that first text is in a descendant.

Example: The fictional tag sequence for this HTML fragment:

    <div>
    <p>The first text.

is:

    <div>
    <p><div::first-letter><p::first-letter>T</...></...>he first text.

In CSS the first letter of a table-cell or inline-block cannot be the first letter of an ancestor element. Thus, in `<DIV><P STYLE="display: inline-block">Hello<BR>Goodbye</P> etcetera</DIV>` the first letter of the `DIV` is not the letter "H". In fact, the `DIV` doesn’t have a first letter. If an element is a list item (display: list-item), the ::first-letter applies to the first letter in the principal box after the marker. User-Agents may ignore ::first-letter on list items with list-style-position: inside. If an element has ::before or ::after content, the ::first-letter applies to the first letter of the element including that content.

Example: After the rule p::before {content: "Note: "}, the selector p::first-letter matches the "N" of "Note".

#### 2.2.2. Styling the ::first-letter Pseudo-element

In CSS a ::first-letter pseudo-element is similar to an inline-level element. The following properties that apply to ::first-letter pseudo-elements:

- all font properties (see [CSS-FONTS-3])
- the color and opacity properties (see [CSS-COLOR-3])
- all background properties (see [CSS-BACKGROUNDS-3])
- any typesetting properties that apply to inline elements (see [CSS-TEXT-3])
- all text decoration properties (see [CSS-TEXT-DECOR-3])
- any inline layout properties that apply to inline elements (see [CSS-INLINE-3])
- margin and padding properties (see [CSS2])
- border properties and box-shadow (see [CSS-BACKGROUNDS-3])
- any other properties defined to apply to ::first-letter by their respective specifications

User agents may apply other properties as well.

Note: In previous levels of CSS, User Agents were allowed to choose a line height, width and height based on the shape of the letter, approximate font sizes, or to take the glyph outline into account when formatting. This possibility has been intentionally removed, as it proved to be a poor solution for the intended use case (Drop Caps), yet caused interoperability problems.

Example: This CSS and HTML example shows a possible rendering of an initial cap. Note that the fictional start tag of the first letter is inside the span, and thus the font weight of the first letter is normal, not bold as the span:

    p { line-height: 1.1 }
    p::first-letter { font-size: 3em; font-weight: normal }
    span { font-weight: bold }
    ...
    <p><span>Het hemelsche</span> gerecht heeft zich ten lange lesten<br>
    Erbarremt over my en mijn benaeuwde vesten<br>
    En arme burgery, en op mijn volcx gebed<br>
    En dagelix geschrey de bange stad ontzet.

The following CSS will make a drop cap initial letter span about two lines:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
    <HTML>
     <HEAD>
      <TITLE>Drop cap initial letter</TITLE>
      <STYLE type="text/css">
       P               { font-size: 12pt; line-height: 1.2 }
       P::first-letter { font-size: 200%; font-weight: bold; float: left }
       SPAN            { text-transform: uppercase }
      </STYLE>
     </HEAD>
     <BODY>
      <P><SPAN>The first</SPAN> few words of an article
        in The Economist.</P>
     </BODY>
    </HTML>

This example might be formatted as follows:

The fictional tag sequence is:

    <P>
      <SPAN>
        <P::first-letter>
          T
        </P::first-letter>he first
      </SPAN>
      few words of an article in the Economist.
    </P>

Note that the ::first-letter pseudo-element tags abut the content (i.e., the initial character), while the ::first-line pseudo-element start tag is inserted right after the start tag of the block element.

## 3. Highlight Pseudo-elements

### 3.1. Selecting Highlighted Content: the ::selection, ::inactive-selection, ::spelling-error, and ::grammar-error pseudo-elements

The highlight pseudo-elements represent portions of a document that have been given a particular status and are typically styled differently to indicate that status to the user. For example, selected portions of the document are typically highlighted (given alternate background and foreground colors, or a color wash) to indicate their selected status. The following highlight pseudo-elements are defined:

::selection
::inactive-selection
  The ::selection and ::inactive-selection pseudo-elements represent the portion of a document that has been selected as the target or object of some possible future user-agent operation(s). They apply, for example, to selected text within an editable text field, which would be copied by a copy operation or replaced by a paste operation.

  ::selection applies to active selections, whereas ::inactive-selection applies to inactive selections (e.g. when the document window is inactive and therefore not receiving events).

::spelling-error
  The ::spelling-error pseudo-element represents a portion of text that has been flagged by the user agent as misspelled.
::grammar-error
  The ::grammar-error pseudo-element represents a portion of text that has been flagged by the user agent as grammatically incorrect.

The highlight pseudo-elements do not necessarily fit into the element tree, and can arbitrarily cross element boundaries without honoring its nesting structure.

The following addition is made to the default UA stylesheet:

    /* Represent default spelling/grammar error styling in an adjustable way */
    :root::spelling-error { text-decoration-line: spelling-error; }
    :root::grammar-error  { text-decoration-line: grammar-error; }
    /* Ensure contrast on text with shadows */
    :root::selection      { text-shadow: none; }

Note: A future level of CSS may introduce ways to create custom highlight pseudo-elements.

### 3.2. Styling Highlights

The highlight pseudo-elements can only be styled by a limited set of properties that do not affect layout. The following properties apply to the highlight pseudo-elements:

- color
- background-color
- cursor
- caret-color
- text-decoration and its associated properties
- text-shadow
- stroke-color, fill-color, and stroke-width

Are there any other properties that should be included here?

The color property specifies the color of both the text and all line decorations (underline, overline, line-through) and emphasis marks (text-emphasis) applied to the text by the originating element and its ancestors and descendants.

Note: Historically (and at the time of writing) only color and background-color have been interoperably supported.

### 3.3. Area of a Highlight

For each type of highlighting (see § 3.1 Selecting Highlighted Content: the ::selection, ::inactive-selection, ::spelling-error, and ::grammar-error pseudo-elements) there exists a single highlight overlay for the entire document, the active portions of which are represented by the corresponding highlight pseudo-element. Each box owns the piece of the overlay corresponding to any text or replaced content directly contained by the box.

- For text, the corresponding overlay must cover at least the entire em box and may extend further above/below the em box to the line box edges. Spacing between two characters may also be part of the overlay area, in which case it belongs to the innermost element that contains both characters and is selected when both characters are selected.
- For replaced content, the associated overlay must cover at least the entire replaced object, and may extend outward to include the element’s entire content box.
- The overlay may also include other other areas within the border-box of an element; in this case, those areas belong to the innermost such element that contains the area.

See F2F minutes, dbaron’s message, Daniel’s thread, Gecko notes, Opera notes, Webkit notes

Not sure if this is the correct way of describing the way things work.

### 3.4. Cascading and Per-Element Highlight Styles

Each element draws its own active portions of the highlight overlays, which receives the styles specified by the corresponding highlight pseudo-element styles for which that element is the originating element. When multiple styles conflict, the winning style is determined by the cascade. When any supported property is not given a value by the cascade, it’s value is determined by inheritance from the corresponding highlight pseudo-element of its originating element’s parent element (regardless of whether that property is an inherited property).

For example, if the following rules were applied:

    p::selection      { color: yellow; background: green; }
    p > em::selection { color: orange; }
    em::selection     { color:    red; }

to the following markup:

    <p>Highlight this <em>and this</em>.</p>

The selection highlight would be green throughout, with yellow text outside the `<em>` element and orange text inside it.

Authors wanting multiple selections styles should use :root::selection for their document-wide selection style, since this will allow clean overriding in descendants. ::selection alone applies to every element in the tree, overriding the more specific styles of any ancestors.

For example, if an author specified

    ::selection          { background: blue; }
    p.warning::selection { background:  red; }

and the document included

    <p class="warning">Some <strong>very important information</strong></p>

The highlight would be blue over “very important information” because the `<strong>` element´s ::selection also matches the ::selection { background: blue; } rule. (Remember that * is implied when a tag selector is missing.) The style rules that would give the intended behavior (red highlight within `p.warning`, blue elsewhere) are

    :root::selection     { background: blue; }
    p.warning::selection { background:  red; }

The UA should use the OS-default highlight colors for ::selection when neither color nor background-color has been specified by the author.

Note: This paired-cascading behavior does not allow using the normal cascade (i.g. :root::selection rules in the UA style sheet) to represent the OS default selection colors. However it has been interoperably implemented in browsers and is thus probably a Web-compatibility requirement.

### 3.5. Painting the Highlight

Each highlight pseudo-element draws its background over the corresponding portion of the highlight overlay, painting it immediately below any positioned descendants (i.e. just before step 8 in CSS2.1§E.2). The ::selection overlay is drawn over the ::spelling-error overlay which is drawn over the ::grammar-error overlay.

A highlight pseudo-element also suppresses the drawing of any selected text (and any text decorations applied to that text). Instead the topmost active highlight overlay redraws that text (and its decorations) over the highlight overlay backgrounds using its own color, with currentColor on its color property representing the color of the next highlight pseudo-element layer below, falling back finally to that of the originating element (the colors that would otherwise be used). Any text decorations introduced by each highlight pseudo-element are stacked in the same order as their backgrounds over the text’s original decorations and are all drawn, in their own colors.

Note: The element’s own text decorations (both line decorations and emphasis marks) are thus drawn in the pseudo-element’s own color when that is not currentColor, regardless of their original color or fill specifications.

What should happen with text shadows? Drawing them in their original color is disconcerting if that color is not a shade of gray. Maybe if the overlay has a background, suppress any text shadows below it?

For non-replaced content, the UA must honor the color and background-color (including their alpha channels) as specified. However, for replaced content, the UA should create a semi-transparent wash to coat the content so that it can show through the selection. This wash should be of the specified background-color if that is not transparent, else of the specified color; however the UA may adjust the alpha channel.

### 3.6. Security and Privacy Considerations

Because the styling of spelling and grammar errors can leak information about the contents of a user’s dictionary (which can include the user’s name and even includes the contents of his/her address book!) UAs that implement ::spelling-error and ::grammar-error must prevent pages from being able to read the styling of such highlighted segments.

## 4. Tree-Abiding Pseudo-elements

Tree-abiding pseudo-elements always fit within the box tree. They inherit any inheritable properties from their originating element; non-inheritable properties take their initial values as usual. [CSS-CASCADE-4]

### 4.1. Generated Content Pseudo-elements: ::before and ::after

When their computed content value is not none, these pseudo-elements generate boxes as if they were immediate children of their originating element, and can be styled exactly like any normal document-sourced element in the document tree.

::before
  Represents a styleable child pseudo-element immediately before the originating element’s actual content.
::after
  Represents a styleable child pseudo-element immediately after the originating element’s actual content.

For example, the following rule inserts the string “Note: ” before the content of every `<p>` element whose `class` attribute has the value `note`:

    p.note::before { content: "Note: " }

Since the initial value of display is inline, this will generate an inline box. Like other inline children of `<p>`, it will participate in `<p>`’s inline formatting context, potentially sharing a line with other content.

As with the content of regular elements, the generated content of ::before and :after pseudo-elements may be included in any ::first-line and ::first-letter pseudo-elements applied to its originating element.

### 4.2. List Markers: the ::marker pseudo-element

The ::marker pseudo-element represents the automatically generated marker box of a list item. (See [CSS-DISPLAY-3] and [CSS-LISTS-3].)

The following CSS properties apply to a ::marker pseudo-element:

- all font properties (see [CSS-FONTS-3])
- the white-space property (see [CSS-TEXT-3])
- the color property (see [CSS-COLOR-3])
- the text-combine-upright, unicode-bidi, and direction properties (see [CSS-WRITING-MODES-3])
- the content property (see [CSS-LISTS-3])

It is expected that future specifications will extend this list of properties; however at the moment marker box layout is not fully defined, so only these properties are allowed.

UAs must add the following rule to their default style sheet:

    ::marker, ::before::marker, ::after::marker {
      unicode-bidi: isolate;
      font-variant-numeric: tabular-nums;
    }

Note: Although the ::marker pseudo-element can represent the marker box of a ::before or ::after pseudo-element, the compound selector ::marker, which expands to *::marker [SELECTORS-4], will not select these markers—an originating element that is a pseudo-element needs to be explicitly specified in the selector, e.g. ::before::marker.

### 4.3. Placeholder Input: the ::placeholder pseudo-element

The ::placeholder pseudo-element represents placeholder text in an input field: text that represents the input and provides a hint to the user on how to fill out the form. For example, a date-input field might have the placeholder text “YYYY/MM/DD” to clarify that numeric dates are to be entered in year-month-day order.

Note: There also exists a :placeholder-shown pseudo-class, which applies to (real) elements while they are showing placeholder text, and can be used to style such elements specially. ::placeholder specifically selects a pseudo-element representing the placeholder text, and is thus relatively limited in its abilities.

All properties that apply to the ::first-line pseudo-element also apply to the ::placeholder pseudo-element.

In interactive media, placeholder text is often hidden once the user has entered input; however this is not a requirement, and both the input value and the placeholder text may be visible simultaneously. The exact behavior is UA-defined. Note that in static media (such as print) placeholder text will be present even after the user has entered input.

Authors seem to want text-align on the list of supported properties. See e.g. comments here.

Note: It’s been requested that ::placeholder also refer to a placeholder which has a corresponding element in the element tree. It’s not clear how this should work, but it may be worth doing. See Issue 2417.

## 5. Overlapping Pseudo-element Interactions

Recall that

- the contents of ::before and ::after are selected exactly as if they were normal elements in the document source tree
- the ::first-letter boundaries are tightly wrapped around the first letter text, and ::first-letter is constrained to exist solely on the first formatted line.
- the ::first-line start is inserted just inside the containing block’s element boundary, and its end after the close of all content on the line

The following CSS and HTML example illustrates how overlapping pseudo-elements interact:

    <style>
    p { color: red; font-size: 12pt }
    p::first-letter { color: green; font-size: 200% }
    p::first-line { color: blue }
    </style>

    <p>Some text that ends up on two lines</p>

The first letter of each P element will be green with a font size of ’24pt'. The rest of the first formatted line will be blue while the rest of the paragraph will be red.

Assuming that a line break will occur before the word "ends", the fictional tag sequence for this fragment might be:

    <p>
      <p::first-line>
        <p::first-letter>
          S
        </p::first-letter>
        ome text that
      </p::first-line>
      ends up on two lines
    </p>

## 6. Additions to the CSS Object Model

### 6.1. `CSSPseudoElement` Interface

The `CSSPseudoElement` interface allows pseudo-elements to be event targets.

    [Exposed=Window]
    interface CSSPseudoElement : EventTarget {
        readonly attribute CSSOMString type;
        readonly attribute Element element;
    };

The `type` attribute is a string representing the type of the pseudo-element. This can be one of the following values:

`"::before"`
  Represents the ::before pseudo-element.
`"::after"`
  Represents the ::after pseudo-element.
`"::marker"`
  Represents the ::marker pseudo-element.

The `element` attribute is the originating element of the pseudo-element.

Note: This interface may be extended in the future to other pseudo-element types and/or to allow setting style information through a `CSSStyleDeclaration` `style` attribute. The current functionality is limited to that which is needed to support [web-animations-1].

### 6.2. `pseudo()` method of the `Element` interface

A new method is added to the `Element` interface to retrieve pseudo-elements created by a given element for a given type:

    partial interface Element {
      CSSPseudoElement? pseudo(CSSOMString type);
    };

The `pseudo(CSSOMString type)` method is used to retrieve the `CSSPseudoElement` instance of the type matching `type` associated with the element. When it is called, execute the following steps:

1. Parse the `type` argument as a <pseudo-element-selector>, and let type be the result.

2. If type is failure, return null.

3. Otherwise, return the `CSSPseudoElement` object representing the pseudo-element that would match the selector type with this as its originating element.

Return values that represent the same pseudo-element on the same originating element must be, insofar as observable, always the same `CSSPseudoElement` object. (The UA may drop or regenerate the object for convenience or performance if this is not observable.)

The identity, lifetime, and nullness of the return value (and potential error cases) of the `pseudo()` method is still under discussion. See Issue 3607 and Issue 3603.

## 7. Compatibilitiy Syntax

For compatibility with existing style sheets written against CSS Level 2 [CSS2], user agents must also accept the previous one-colon notation (`:before`, `:after`, `:first-letter`, `:first-line`) for the ::before, ::after, ::first-letter, and ::first-line pseudo-elements.

## Changes

Changes since the 25 February 2019 Working Draft include:

- Added ::marker to types allowed for `CSSPseudoElement` interface.
- Clarified return value of `pseudo()`.
- Added content, unicode-bidi, and direction to properties allowed on ::marker.
- Added ruby-position to properties allowed on ::first-line, analogous with text-emphasis-position. (Issue 2998)

Changes since the 7 June 2016 Working Draft include:

- Specified spelling-error and grammar-error with ::spelling-error and ::grammar-error in the UA stylesheet.
- Redefined value propagation between parent/child highlight pseudo-elements to use inheritance rather than cascading. See discussion in and linked from Issue 2474.
- Refined list of supported properties for highlight pseudo-elements, e.g. adding stroke-color/fill-color, removing outline, etc.
- Clarified how text and text decoration colors are painted for highlight pseudo-elements.
- Added the `element` attribute to the `CSSPseudoElement` interface.
- Changed the values of the `type` attribute on the `CSSPseudoElement` interface to match the corresponding pseudo-elements.
- Reduced supported types of `CSSPseudoElement` and removed unimplemented `style` attribute.
- Changed `window.getPseudoElements(elem,type)` to `Element.pseudo(type)`.
- Miscellaneous minor clarifications and fixes.

## Acknowledgements

The editors would like to thank the following individuals for their contributions, either during the conception of the specification or during its development and specification review process: Tab Atkins, David Baron, Razvan Caliman, Chris Coyier, Anders Grimsrud, Vincent Hardy.

## Conformance

### Document conventions

Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this document are to be interpreted as described in RFC 2119. However, for readability, these words do not appear in all uppercase letters in this specification.

All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes. [RFC2119]

Examples in this specification are introduced with the words “for example” or are set apart from the normative text with `class="example"`, like this:

This is an example of an informative example.

Informative notes begin with the word “Note” and are set apart from the normative text with `class="note"`, like this:

Note, this is an informative note.

Advisements are normative sections styled to evoke special attention and are set apart from other normative text with `<strong class="advisement">`, like this: UAs MUST provide an accessible alternative.

### Conformance classes

Conformance to this specification is defined for three conformance classes:

style sheet
  A CSS style sheet.
renderer
  A UA that interprets the semantics of a style sheet and renders documents that use them.
authoring tool
  A UA that writes a style sheet.

A style sheet is conformant to this specification if all of its statements that use syntax defined in this module are valid according to the generic CSS grammar and the individual grammars of each feature defined in this module.

A renderer is conformant to this specification if, in addition to interpreting the style sheet as defined by the appropriate specifications, it supports all the features defined by this specification by parsing them correctly and rendering the document accordingly. However, the inability of a UA to correctly render a document due to limitations of the device does not make the UA non-conformant. (For example, a UA is not required to render color on a monochrome monitor.)

An authoring tool is conformant to this specification if it writes style sheets that are syntactically correct according to the generic CSS grammar and the individual grammars of each feature in this module, and meet all other conformance requirements of style sheets as described in this module.

### Requirements for Responsible Implementation of CSS

The following sections define several conformance requirements for implementing CSS responsibly, in a way that promotes interoperability in the present and future.

#### Partial Implementations

So that authors can exploit the forward-compatible parsing rules to assign fallback values, CSS renderers must treat as invalid (and ignore as appropriate) any at-rules, properties, property values, keywords, and other syntactic constructs for which they have no usable level of support. In particular, user agents must not selectively ignore unsupported property values and honor supported values in a single multi-value property declaration: if any value is considered invalid (as unsupported values must be), CSS requires that the entire declaration be ignored.

#### Implementations of Unstable and Proprietary Features

To avoid clashes with future stable CSS features, the CSSWG recommends following best practices for the implementation of unstable features and proprietary extensions to CSS.

#### Implementations of CR-level Features

Once a specification reaches the Candidate Recommendation stage, implementers should release an unprefixed implementation of any CR-level feature they can demonstrate to be correctly implemented according to spec, and should avoid exposing a prefixed variant of that feature.

To establish and maintain the interoperability of CSS across implementations, the CSS Working Group requests that non-experimental CSS renderers submit an implementation report (and, if necessary, the testcases used for that implementation report) to the W3C before releasing an unprefixed implementation of any CSS features. Testcases submitted to W3C are subject to review and correction by the CSS Working Group.

Further information on submitting testcases and implementation reports can be found from on the CSS Working Group’s website at http://www.w3.org/Style/CSS/Test/. Questions should be directed to the public-css-testsuite@w3.org mailing list.

## Index

### Terms defined by this specification

- ::after, in §4.1
- ::before, in §4.1
- CSSPseudoElement, in §6.1
- element, in §6.1
- fictional tag sequence, in §2.1
- first formatted line, in §2.1.1
- ::first-letter, in §2.2
- ::first-line, in §2.1
- ::grammar-error, in §3.1
- highlight overlay, in §3.3
- highlight pseudo-element, in §3.1
- ::inactive-selection, in §3.1
- ::marker, in §4.2
- ::placeholder, in §4.3
- pseudo(type), in §6.2
- ::selection, in §3.1
- ::spelling-error, in §3.1
- tree-abiding, in §4
- tree-abiding pseudo-element, in §4
- type, in §6.1

https://drafts.csswg.org/css-backgrounds-3/#propdef-background-color Referenced in:

- 3.2. Styling Highlights (2)
- 3.4. Cascading and Per-Element Highlight Styles
- 3.5. Painting the Highlight (2)

https://drafts.csswg.org/css-backgrounds-3/#propdef-box-shadow Referenced in:

- 2.2.2. Styling the ::first-letter Pseudo-element

https://drafts.csswg.org/css-cascade-4/#inheritance Referenced in:

- 4. Tree-Abiding Pseudo-elements

https://drafts.csswg.org/css-cascade-4/#inherited-property Referenced in:

- 3.4. Cascading and Per-Element Highlight Styles

https://drafts.csswg.org/css-cascade-4/#initial-value Referenced in:

- 4. Tree-Abiding Pseudo-elements

https://drafts.csswg.org/css-cascade-4/#cascade-origin-ua Referenced in:

- 3.4. Cascading and Per-Element Highlight Styles

https://drafts.csswg.org/css-color-3/#color0 Referenced in:

- 2.1.2. Styling the First Line Pseudo-element
- 2.2.2. Styling the ::first-letter Pseudo-element
- 3.2. Styling Highlights (2) (3)
- 3.4. Cascading and Per-Element Highlight Styles
- 3.5. Painting the Highlight (2) (3) (4) (5) (6)
- 4.2. List Markers: the ::marker pseudo-element

https://www.w3.org/TR/css3-color/#currentcolor-def Referenced in:

- 3.5. Painting the Highlight (2)

https://drafts.csswg.org/css-color-4/#propdef-opacity Referenced in:

- 2.1.2. Styling the First Line Pseudo-element
- 2.2.2. Styling the ::first-letter Pseudo-element

https://drafts.csswg.org/css-color-4/#valdef-color-transparent Referenced in:

- 3.5. Painting the Highlight

https://drafts.csswg.org/css-content-3/#propdef-content Referenced in:

- 4.1. Generated Content Pseudo-elements: ::before and ::after
- 4.2. List Markers: the ::marker pseudo-element
- Changes

https://drafts.csswg.org/css-content-3/#valdef-content-none Referenced in:

- 4.1. Generated Content Pseudo-elements: ::before and ::after

https://drafts.csswg.org/css-display-3/#block-container Referenced in:

- 2.1.1. Finding the First Formatted Line

https://drafts.csswg.org/css-display-3/#propdef-display Referenced in:

- 2.2.1. Finding the First Letter
- 4.1. Generated Content Pseudo-elements: ::before and ::after

https://drafts.csswg.org/css-display-3/#valdef-display-inline Referenced in:

- 4.1. Generated Content Pseudo-elements: ::before and ::after

https://drafts.csswg.org/css-lists-3/#list-item Referenced in:

- 4.2. List Markers: the ::marker pseudo-element

https://drafts.csswg.org/css-lists-3/#propdef-list-style-position Referenced in:

- 2.2.1. Finding the First Letter

https://drafts.csswg.org/css-ruby-1/#propdef-ruby-position Referenced in:

- 2.1.2. Styling the First Line Pseudo-element
- Changes

https://drafts.csswg.org/css-syntax-3/#css-parse-something-according-to-a-css-grammar Referenced in:

- 6.2. pseudo() method of the Element interface

https://drafts.csswg.org/css-text-3/#propdef-text-align Referenced in:

- 4.3. Placeholder Input: the ::placeholder pseudo-element

https://drafts.csswg.org/css-text-3/#typographic-letter-unit Referenced in:

- 2.2. The ::first-letter pseudo-element (2) (3) (4) (5)

https://drafts.csswg.org/css-text-3/#unicode-general-category Referenced in:

- 2.2. The ::first-letter pseudo-element

https://drafts.csswg.org/css-text-4/#propdef-white-space Referenced in:

- 4.2. List Markers: the ::marker pseudo-element

https://drafts.csswg.org/css-text-decor-3/#propdef-text-decoration Referenced in:

- 3.2. Styling Highlights

https://drafts.csswg.org/css-text-decor-3/#propdef-text-emphasis Referenced in:

- 3.2. Styling Highlights

https://drafts.csswg.org/css-text-decor-3/#propdef-text-emphasis-position Referenced in:

- Changes

https://drafts.csswg.org/css-text-decor-3/#propdef-text-shadow Referenced in:

- 3.2. Styling Highlights

https://drafts.csswg.org/css-text-decor-4/#valdef-text-decoration-line-grammar-error Referenced in:

- Changes

https://drafts.csswg.org/css-text-decor-4/#valdef-text-tecoration-line-spelling-error Referenced in:

- Changes

https://drafts.csswg.org/css-ui-4/#propdef-caret-color Referenced in:

- 3.2. Styling Highlights

https://drafts.csswg.org/css-ui-4/#propdef-cursor Referenced in:

- 3.2. Styling Highlights

https://drafts.csswg.org/css-ui-4/#propdef-outline Referenced in:

- Changes

https://drafts.csswg.org/css-writing-modes-3/#propdef-direction Referenced in:

- 4.2. List Markers: the ::marker pseudo-element
- Changes

https://drafts.csswg.org/css-writing-modes-3/#propdef-unicode-bidi Referenced in:

- 4.2. List Markers: the ::marker pseudo-element
- Changes

https://drafts.csswg.org/css-writing-modes-4/#propdef-text-combine-upright Referenced in:

- 4.2. List Markers: the ::marker pseudo-element

https://drafts.csswg.org/cssom-1/#cssomstring Referenced in:

- 6.1. CSSPseudoElement Interface
- 6.2. pseudo() method of the Element interface

https://drafts.csswg.org/cssom-1/#cssstyledeclaration Referenced in:

- 6.1. CSSPseudoElement Interface

https://dom.spec.whatwg.org/#element Referenced in:

- 6.1. CSSPseudoElement Interface
- 6.2. pseudo() method of the Element interface (2) (3)

https://dom.spec.whatwg.org/#eventtarget Referenced in:

- 6.1. CSSPseudoElement Interface

https://drafts.fxtf.org/fill-stroke-3/#propdef-fill-color Referenced in:

- 3.2. Styling Highlights
- Changes

https://drafts.fxtf.org/fill-stroke-3/#propdef-stroke-color Referenced in:

- 3.2. Styling Highlights
- Changes

https://drafts.fxtf.org/fill-stroke-3/#propdef-stroke-width Referenced in:

- 3.2. Styling Highlights

https://drafts.csswg.org/selectors-3/#x Referenced in:

- 3.4. Cascading and Per-Element Highlight Styles

https://drafts.csswg.org/selectors-4/#placeholder-shown-pseudo Referenced in:

- 4.3. Placeholder Input: the ::placeholder pseudo-element

https://drafts.csswg.org/selectors-4/#typedef-pseudo-element-selector Referenced in:

- 6.2. pseudo() method of the Element interface

https://drafts.csswg.org/selectors-4/#compound Referenced in:

- 4.2. List Markers: the ::marker pseudo-element

https://drafts.csswg.org/selectors-4/#originating-element Referenced in:

- 1. Introduction
- 2.1. The ::first-line pseudo-element
- 2.2. The ::first-letter pseudo-element
- 3.2. Styling Highlights
- 3.4. Cascading and Per-Element Highlight Styles (2)
- 3.5. Painting the Highlight
- 4. Tree-Abiding Pseudo-elements
- 4.1. Generated Content Pseudo-elements: ::before and ::after (2) (3) (4)
- 4.2. List Markers: the ::marker pseudo-element
- 6.1. CSSPseudoElement Interface
- 6.2. pseudo() method of the Element interface (2)

https://drafts.csswg.org/selectors-4/#pseudo-element Referenced in:

- 1. Introduction
- 4.2. List Markers: the ::marker pseudo-element
- 6.2. pseudo() method of the Element interface

https://drafts.csswg.org/selectors-4/#selector Referenced in:

- 1. Introduction
- 4.2. List Markers: the ::marker pseudo-element

https://heycam.github.io/webidl/#Exposed Referenced in:

- 6.1. CSSPseudoElement Interface

https://heycam.github.io/webidl/#this Referenced in:

- 6.2. pseudo() method of the Element interface

### Terms defined by reference

- [CSS-BACKGROUNDS-3] defines the following terms:
  - background-color
  - box-shadow
- [CSS-CASCADE-4] defines the following terms:
  - inheritance
  - inherited property
  - initial value
  - ua style sheet
- [CSS-COLOR-3] defines the following terms:
  - color
  - currentcolor
- [css-color-4] defines the following terms:
  - opacity
  - transparent
- [css-content-3] defines the following terms:
  - content
  - none
- [CSS-DISPLAY-3] defines the following terms:
  - block container
  - display
  - inline
- [CSS-LISTS-3] defines the following terms:
  - list item
  - list-style-position
- [CSS-RUBY-1] defines the following terms:
  - ruby-position
- [css-syntax-3] defines the following terms:
  - parse
- [CSS-TEXT-3] defines the following terms:
  - text-align
  - typographic letter unit
  - unicode general category
- [css-text-4] defines the following terms:
  - white-space
- [CSS-TEXT-DECOR-3] defines the following terms:
  - text-decoration
  - text-emphasis
  - text-emphasis-position
  - text-shadow
- [css-text-decor-4] defines the following terms:
  - grammar-error
  - spelling-error
- [css-ui-4] defines the following terms:
  - caret-color
  - cursor
  - outline
- [CSS-WRITING-MODES-3] defines the following terms:
  - direction
  - unicode-bidi
- [css-writing-modes-4] defines the following terms:
  - text-combine-upright
- [cssom-1] defines the following terms:
  - CSSOMString
  - CSSStyleDeclaration
- [DOM] defines the following terms:
  - Element
  - EventTarget
- [fill-stroke-3] defines the following terms:
  - fill-color
  - stroke-color
  - stroke-width
- [selectors-3] defines the following terms:
  - *
- [SELECTORS-4] defines the following terms:
  - :placeholder-shown
  - <pseudo-element-selector>
  - compound selector
  - originating element
  - pseudo-element
  - selector
- [WebIDL] defines the following terms:
  - Exposed
  - this

## References

### Normative References

[CSS-BACKGROUNDS-3]
  Bert Bos; Elika Etemad; Brad Kemper. CSS Backgrounds and Borders Module Level 3. 17 October 2017. CR. URL: https://www.w3.org/TR/css-backgrounds-3/
[CSS-CASCADE-4]
  Elika Etemad; Tab Atkins Jr.. CSS Cascading and Inheritance Level 4. 28 August 2018. CR. URL: https://www.w3.org/TR/css-cascade-4/
[CSS-COLOR-3]
  Tantek Çelik; Chris Lilley; David Baron. CSS Color Module Level 3. 19 June 2018. REC. URL: https://www.w3.org/TR/css-color-3/
[CSS-COLOR-4]
  Tab Atkins Jr.; Chris Lilley. CSS Color Module Level 4. 5 March 2019. WD. URL: https://www.w3.org/TR/css-color-4/
[CSS-CONTENT-3]
  Elika Etemad; Dave Cramer. CSS Generated Content Module Level 3. 2 June 2016. WD. URL: https://www.w3.org/TR/css-content-3/
[CSS-DISPLAY-3]
  Tab Atkins Jr.; Elika Etemad. CSS Display Module Level 3. 28 August 2018. CR. URL: https://www.w3.org/TR/css-display-3/
[CSS-LISTS-3]
  Elika Etemad; Tab Atkins Jr.. CSS Lists Module Level 3. 25 April 2019. WD. URL: https://www.w3.org/TR/css-lists-3/
[CSS-RUBY-1]
  Elika Etemad; Koji Ishii. CSS Ruby Layout Module Level 1. 5 August 2014. WD. URL: https://www.w3.org/TR/css-ruby-1/
[CSS-SYNTAX-3]
  Tab Atkins Jr.; Simon Sapin. CSS Syntax Module Level 3. 20 February 2014. CR. URL: https://www.w3.org/TR/css-syntax-3/
[CSS-TEXT-3]
  Elika Etemad; Koji Ishii; Florian Rivoal. CSS Text Module Level 3. 12 December 2018. WD. URL: https://www.w3.org/TR/css-text-3/
[CSS-TEXT-4]
  Elika Etemad; Koji Ishii; Alan Stearns. CSS Text Module Level 4. 20 September 2018. WD. URL: https://www.w3.org/TR/css-text-4/
[CSS-TEXT-DECOR-3]
  Elika Etemad; Koji Ishii. CSS Text Decoration Module Level 3. 3 July 2018. CR. URL: https://www.w3.org/TR/css-text-decor-3/
[CSS-TEXT-DECOR-4]
  Elika Etemad; Koji Ishii. CSS Text Decoration Module Level 4. 13 March 2018. WD. URL: https://www.w3.org/TR/css-text-decor-4/
[CSS-UI-4]
  Florian Rivoal. CSS Basic User Interface Module Level 4. 22 December 2017. WD. URL: https://www.w3.org/TR/css-ui-4/
[CSS-WRITING-MODES-3]
  Elika Etemad; Koji Ishii. CSS Writing Modes Level 3. 24 May 2018. CR. URL: https://www.w3.org/TR/css-writing-modes-3/
[CSS-WRITING-MODES-4]
  Elika Etemad; Koji Ishii. CSS Writing Modes Level 4. 24 May 2018. CR. URL: https://www.w3.org/TR/css-writing-modes-4/
[CSSOM-1]
  Simon Pieters; Glenn Adams. CSS Object Model (CSSOM). 17 March 2016. WD. URL: https://www.w3.org/TR/cssom-1/
[DOM]
  Anne van Kesteren. DOM Standard. Living Standard. URL: https://dom.spec.whatwg.org/
[FILL-STROKE-3]
  Elika Etemad; Tab Atkins Jr.. CSS Fill and Stroke Module Level 3. 13 April 2017. WD. URL: https://www.w3.org/TR/fill-stroke-3/
[RFC2119]
  S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL: https://tools.ietf.org/html/rfc2119
[SELECTORS-4]
  Elika Etemad; Tab Atkins Jr.. Selectors Level 4. 21 November 2018. WD. URL: https://www.w3.org/TR/selectors-4/
[UAX44]
  Ken Whistler; Laurențiu Iancu. Unicode Character Database. 27 February 2019. Unicode Standard Annex #44. URL: https://www.unicode.org/reports/tr44/tr44-24.html
[WebIDL]
  Boris Zbarsky. Web IDL. 15 December 2016. ED. URL: https://heycam.github.io/webidl/

### Informative References

[CSS-FONTS-3]
  John Daggett; Myles Maxfield; Chris Lilley. CSS Fonts Module Level 3. 20 September 2018. REC. URL: https://www.w3.org/TR/css-fonts-3/
[CSS-INLINE-3]
  Dave Cramer; Elika Etemad; Steve Zilles. CSS Inline Layout Module Level 3. 8 August 2018. WD. URL: https://www.w3.org/TR/css-inline-3/
[CSS2]
  Bert Bos; et al. Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification. 7 June 2011. REC. URL: https://www.w3.org/TR/CSS2/
[HTML5]
  Ian Hickson; et al. HTML5. 27 March 2018. REC. URL: https://www.w3.org/TR/html5/
[SELECTORS-3]
  Tantek Çelik; et al. Selectors Level 3. 6 November 2018. REC. URL: https://www.w3.org/TR/selectors-3/
[UAX29]
  Mark Davis. Unicode Text Segmentation. 15 February 2019. Unicode Standard Annex #29. URL: https://www.unicode.org/reports/tr29/tr29-35.html
[WEB-ANIMATIONS-1]
  Brian Birtles; et al. Web Animations. 11 October 2018. WD. URL: https://www.w3.org/TR/web-animations-1/

## IDL Index

    [Exposed=Window]
    interface CSSPseudoElement : EventTarget {
        readonly attribute CSSOMString type;
        readonly attribute Element element;
    };

    partial interface Element {
      CSSPseudoElement? pseudo(CSSOMString type);
    };

## Issues Index

Are there any other properties that should be included here? ↵
See F2F minutes, dbaron’s message, Daniel’s thread, Gecko notes, Opera notes, Webkit notes ↵
Not sure if this is the correct way of describing the way things work. ↵
What should happen with text shadows? Drawing them in their original color is disconcerting if that color is not a shade of gray. Maybe if the overlay has a background, suppress any text shadows below it? ↵
Authors seem to want text-align on the list of supported properties. See e.g. comments here. ↵
The identity, lifetime, and nullness of the return value (and potential error cases) of the `pseudo()` method is still under discussion. See Issue 3607 and Issue 3603. ↵
#selectordef-first-line Referenced in:

- 1. Introduction
- 2.1. The ::first-line pseudo-element (2)
- 2.1.1. Finding the First Formatted Line (2)
- 2.1.2. Styling the First Line Pseudo-element (2) (3)
- 2.1.3. Inheritance and the ::first-line Pseudo-element (2) (3)
- 2.2. The ::first-letter pseudo-element (2)
- 4.1. Generated Content Pseudo-elements: ::before and ::after
- 4.3. Placeholder Input: the ::placeholder pseudo-element
- 5. Overlapping Pseudo-element Interactions
- 7. Compatibilitiy Syntax
- Changes

#fictional-tag-sequence Referenced in:

- 2.1. The ::first-line pseudo-element (2) (3)
- 2.1.1. Finding the First Formatted Line
- 2.2.1. Finding the First Letter
- 2.2.2. Styling the ::first-letter Pseudo-element
- 5. Overlapping Pseudo-element Interactions

#first-formatted-line Referenced in:

- 2.1. The ::first-line pseudo-element
- 2.2. The ::first-letter pseudo-element
- 2.2.1. Finding the First Letter

#selectordef-first-letter Referenced in:

- 2.2. The ::first-letter pseudo-element (2) (3) (4) (5) (6) (7)
- 2.2.1. Finding the First Letter (2) (3) (4) (5) (6)
- 2.2.2. Styling the ::first-letter Pseudo-element (2) (3) (4)
- 4.1. Generated Content Pseudo-elements: ::before and ::after
- 5. Overlapping Pseudo-element Interactions (2)
- 7. Compatibilitiy Syntax

#highlight-pseudo-element Referenced in:

- 3.1. Selecting Highlighted Content: the ::selection, ::inactive-selection, ::spelling-error, and ::grammar-error pseudo-elements (2)
- 3.2. Styling Highlights (2)
- 3.3. Area of a Highlight
- 3.4. Cascading and Per-Element Highlight Styles (2)
- 3.5. Painting the Highlight (2) (3) (4)

#selectordef-selection Referenced in:

- 3.1. Selecting Highlighted Content: the ::selection, ::inactive-selection, ::spelling-error, and ::grammar-error pseudo-elements (2) (3)
- 3.4. Cascading and Per-Element Highlight Styles (2) (3)
- 3.5. Painting the Highlight

#selectordef-inactive-selection Referenced in:

- 3.1. Selecting Highlighted Content: the ::selection, ::inactive-selection, ::spelling-error, and ::grammar-error pseudo-elements (2) (3)

#selectordef-spelling-error Referenced in:

- 3.1. Selecting Highlighted Content: the ::selection, ::inactive-selection, ::spelling-error, and ::grammar-error pseudo-elements (2)
- 3.5. Painting the Highlight
- 3.6. Security and Privacy Considerations
- Changes

#selectordef-grammar-error Referenced in:

- 3.1. Selecting Highlighted Content: the ::selection, ::inactive-selection, ::spelling-error, and ::grammar-error pseudo-elements (2)
- 3.5. Painting the Highlight
- 3.6. Security and Privacy Considerations
- Changes

#highlight-overlay Referenced in:

- 3.4. Cascading and Per-Element Highlight Styles
- 3.5. Painting the Highlight (2) (3)

#selectordef-before Referenced in:

- 2.2.1. Finding the First Letter
- 4.1. Generated Content Pseudo-elements: ::before and ::after (2)
- 4.2. List Markers: the ::marker pseudo-element
- 5. Overlapping Pseudo-element Interactions
- 6.1. CSSPseudoElement Interface
- 7. Compatibilitiy Syntax

#selectordef-after Referenced in:

- 2.2.1. Finding the First Letter
- 4.1. Generated Content Pseudo-elements: ::before and ::after
- 4.2. List Markers: the ::marker pseudo-element
- 5. Overlapping Pseudo-element Interactions
- 6.1. CSSPseudoElement Interface
- 7. Compatibilitiy Syntax

#selectordef-marker Referenced in:

- 4.2. List Markers: the ::marker pseudo-element (2) (3) (4)
- 6.1. CSSPseudoElement Interface
- Changes (2)

#selectordef-placeholder Referenced in:

- 4.3. Placeholder Input: the ::placeholder pseudo-element (2) (3) (4)

#csspseudoelement Referenced in:

- 6.1. CSSPseudoElement Interface (2)
- 6.2. pseudo() method of the Element interface (2) (3) (4)
- Changes (2) (3) (4)

#dom-csspseudoelement-type Referenced in:

- 6.1. CSSPseudoElement Interface
- Changes

#dom-csspseudoelement-element Referenced in:

- 6.1. CSSPseudoElement Interface
- Changes

#dom-element-pseudo-type-type Referenced in:

- 6.2. pseudo() method of the Element interface (2)

#dom-element-pseudo Referenced in:

- 6.2. pseudo() method of the Element interface (2) (3)
- Changes