CSS :default Pseudo-class

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The :default pseudo-class matches form elements that are the default in a related group — for example a radio/checkbox with the checked attribute, a default option, or a form’s default submit button.

It is not the same as :checked. :checked follows the current selection; :default points at the control that was defined as the default.

Baseline · Widely available.

Not deprecated. Cross-browser since about January 2020. Not supported in Internet Explorer.

Teaching tip.

Change a radio group in the live preview: the coral ring (:default) can stay on Summer while the selected radio moves.

CSS Syntax

syntax.css
:default { /* styles for the default control */ }

Often paired with a type or sibling: input:default, option:default, input:default + label.

Common Patterns

PatternDescriptionTry it
Default radioRadio with the checked attributeTry it
Label siblinginput:default + labelTry it
Default checkboxCheckbox marked checked in HTMLTry it
Submit buttonForm’s default submission buttonTry it
option:defaultDefault selected option(s)Try it
vs :checkedCompare default vs current selectionTry it

How to Use :default

Mark the default in HTML, then highlight it in CSS.

  1. Set the default with checked, selected, or rely on the first submit button.
  2. Write :default (or input:default / option:default).
  3. Optionally style the neighboring label with +.
  4. Verify after changing the selection — default and checked may diverge.

Live Preview

Summer starts as the default. Pick another season: coral marks :default; the selected radio is the current choice.

Season group

Uses input:default and input:default + label. Reset restores the Summer selection.

Interactive
Favorite season

Pick a season to compare default vs selected.

CSS Examples

Each snippet focuses on :default. Use Try It Yourself for a live editor.

Example 1 — Default Radio

Highlight the radio that was marked checked in HTML.

CSS
<style>
  input:default {
    outline: 2px solid #f97316;
    outline-offset: 2px;
  }
  input:default + label {
    color: #ea580c;
    font-weight: 700;
  }
</style>

<input type="radio" name="size" id="s" value="s">
<label for="s">S</label>
<input type="radio" name="size" id="m" value="m" checked>
<label for="m">M</label>
Try It Yourself

How It Works

  1. HTML marks the default. checked on the M radio.
  2. input:default. Matches that default control.
  3. Label via +. The following label turns orange.
  4. Try choosing S. Selection changes; default styling can still point at M.

Example 2 — Default Submit Button

Style the form’s default submission button (first submit control in the form).

CSS
<style>
  :default {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
  }
</style>

<form>
  <button type="submit">Save</button>
  <button type="button">Cancel</button>
</form>
Try It Yourself

How It Works

  1. Form context. Default submit is defined relative to the form.
  2. First submit wins. Save is the first submit button.
  3. :default matches Save. Cancel is type="button", so it is not the submit default.
  4. Purple outline. Makes the default action easy to spot.

Example 3 — :default vs :checked

Show both selectors so students can see they are not identical.

CSS
<style>
  input:default + label::after {
    content: " (default)";
    color: #ea580c;
  }
  input:checked + label {
    font-weight: 700;
    color: #2563eb;
  }
</style>

<input type="radio" name="c" id="a" value="a" checked>
<label for="a">A</label>
<input type="radio" name="c" id="b" value="b">
<label for="b">B</label>
Try It Yourself

How It Works

  1. A is the HTML default. It has checked in the markup.
  2. :default adds “(default)”. Tied to that original default.
  3. :checked bolds the current pick. Switch to B to see bold move.
  4. Takeaway. Default ≠ currently selected after the user changes the group.

Edge Cases & Pitfalls

Most confusion is mixing up “default in the form” with “checked right now.”

vs-checked

Not a synonym for :checked

Use :checked for the live selection. Use :default for the original default control.

options

option:default styling varies

Native select UIs limit how much you can style options. Test in your target browsers.

submit

Default submit is about the form

The first submit-capable control belonging to the form is typically the default. Extra buttons with type="button" do not submit.

multiple

Multiple selected options

In a multiple select, more than one option can match :default.

ie

No Internet Explorer support

Do not rely on :default alone if you must support IE; treat it as progressive enhancement.

Browser Support

:default is a browser CSS pseudo-class for form defaults. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Widely available

:default

Chrome 10+, Firefox 4+, Safari 5+, Edge 79+. Widely available since January 2020. Not supported in Internet Explorer.

95% Browser support
Google Chrome 10+
Full support
Mozilla Firefox 4+
Full support
Apple Safari 5+
Full support
Microsoft Edge 79+
Full support
Opera 10+
Full support
Samsung Internet 1+
Full support
Internet Explorer Not supported
Not supported
:default Widely supported

Bottom line: Safe for modern form UX as progressive enhancement. Pair with clear HTML defaults. It is not a runtime API.

Key Takeaways

  • Role: highlight the default control in a form group.
  • vs :checked: default is original; checked is current.
  • Also covers: default options and the form submit button.
  • Enhance: fine for modern browsers; skip IE-only needs.

One line: use :default to style the form’s original default control, not just the current selection.

Frequently Asked Questions

It matches form controls that are the default in their group — such as a radio or checkbox with the checked attribute, a default option, or a form’s default submit button.
option, input (checkbox/radio with checked, and submit-like controls), and button when it is the form’s default submit control.
:default tracks the original default from the markup/form rules. :checked tracks whatever is selected right now. After the user picks another radio, :checked moves; :default usually stays on the original default.
No. A checkbox matches :default when it is marked as the default (typically via the checked attribute in HTML), not merely because the user checked it later.
Yes. :default matches the form’s default submission button — generally the first submit button belonging to that form in DOM order.
It is Baseline and widely available since about January 2020. It is a browser CSS pseudo-class, not a Node.js API. Internet Explorer does not support it.

Next: :disabled

Style form controls that are turned off and cannot be edited.

:disabled tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful