Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

::checkmark — styling the checked indicator

The ::checkmark pseudo-element styles the checked indicator of checkboxes, radio buttons, and option elements using basic control appearance.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

selector::checkmark { /* declarations */ }

::checkmark represents the indicator, whereas :checked selects an element by state. The pseudo-element is generated when the element supports :checked and it or an ancestor has basic appearance. It is fully styleable and inherits from its originating element.

For checkboxes and radio buttons, its box sits between ::before and ::after; for option, before ::before. content determines its contents. :indeterminate::checkmark can style the indeterminate indicator.

This is a draft-specification feature. The example uses appearance: base and requires local verification. The Chromium 152 scope does not establish support or validate the example.

Examples

<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>::checkmark demo</title>
<style>
  input[type="checkbox"] {
    appearance: base;
    inline-size: 2rem;
    block-size: 2rem;
  }
  input[type="checkbox"]::checkmark {
    content: "✓";
    color: #006400;
  }
  input[type="checkbox"]:not(:checked)::checkmark {
    visibility: hidden;
  }
  input[type="checkbox"]:checked::checkmark {
    visibility: visible;
  }
</style>
<label><input type="checkbox" checked> Enable notifications</label>
</html>

Result

With the required features implemented: the checkbox initially displays a dark-green ✓. Unchecking it hides the mark; checking it restores the mark. No console output.

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources