Widely availableSupported across all major browsers. Safe to use in production.

Overview

The :default CSS pseudo-class matches the default element in a group of related form controls, such as checkboxes and radio buttons with the checked attribute.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
10
79
4
5
18
5
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)

Syntax

CSS
input:default {
  outline: 2px solid #3b82f6;
}
input:default + label {
  font-weight: bold;
}

Live demo

defaultbutton

CSS defaultbutton demo.

PreviewFullscreen

defaultradio

CSS defaultradio demo.

PreviewFullscreen

defaultcheckbox

CSS defaultcheckbox demo.

PreviewFullscreen

Use cases

  • Using :default

    The :default CSS pseudo-class matches the default element in a group of related form controls, such as checkboxes and radio buttons with the checked attribute.

Cautions

  • May not be supported in older browsers.

Accessibility

  • Make sure visual changes are conveyed appropriately to assistive technology.

Powered by web-features