The :default pseudo-class styles form elements that are the default choice in their group — the option pre-selected in your HTML when the page loads.
01
Default state
Pre-selected.
02
Radio
checked attr.
03
Select
selected option.
04
Checkbox
Default on.
05
vs :checked
Initial vs now.
06
UX hint
Show defaults.
Fundamentals
Introduction
The :default selector in CSS is a pseudo-class used to target form elements that are the default in a group of related controls. It highlights what the author set as the initial choice in the HTML markup.
This applies to radio buttons and checkboxes with the checked attribute, <option> elements with selected inside a <select>, and the default submit button in a form.
Definition and Usage
Append :default to a selector with no space before the colon: input:default or option:default. Styles apply to elements that represent the default state — including what would be restored if the user resets the form.
💡
Beginner Tip
:default and :checked often match the same element on page load. The difference appears after interaction: :checked follows the user’s current choice, while :default always refers to the originally default element in the HTML.
Only the checkbox with checked in the markup matches :default. Useful for showing which preferences are enabled by default.
Example 4 — :default vs :checked
Compare the initial HTML default with the user’s current selection after they interact with the form.
default-vs-checked.css
/* Original default from HTML */input[type="radio"]:default + label{color:#1d4ed8;}/* Currently selected option */input[type="radio"]:checked + label{text-decoration:underline;}
Email = always blue (default). Whichever is selected gets an underline (:checked).
Click Phone in the live example to see :checked move while :default stays on Email.
How It Works
On load, both match Email. If the user selects Phone, :checked moves to Phone but :default still matches Email because that was the HTML default.
Watch Out
⚠️ Common Pitfalls
Limited elements — :default does not apply to text inputs, textareas, or plain divs.
Confusing with :checked — On page load they often overlap; after user interaction they diverge.
Missing attributes — Without checked or selected in HTML, no element matches :default.
option styling — Browsers restrict styling of <option> elements; visual changes may be subtle.
Over-highlighting — Don’t rely only on color to indicate defaults; add text like “(recommended)” when helpful.
A11y
♿ Accessibility
Labels required — Always pair inputs with <label for="id"> so screen reader users know what each default option means.
Don’t rely on style alone — Supplement :default styling with clear text indicating the recommended choice.
Pre-selected opt-ins — Be careful with checked-by-default marketing checkboxes; some regulations require explicit consent.
Focus styles — Style :focus alongside :default for keyboard users navigating the form.
🧠 How :default Works
1
Author sets defaults in HTML
You add checked or selected to mark the default choice.
HTML
2
Page loads
The browser identifies which control is the default in each group.
Parse
3
:default styles apply
CSS rules for :default highlight the pre-selected elements.
Render
=
✅
Clear default choices
Users can quickly see which options are recommended or pre-selected.
Compatibility
Browser Compatibility
The :default pseudo-class is supported in all modern browsers. Option styling may vary by platform.
✓ Modern browsers · Full support
Default form styling in modern CSS
:default works in Chrome, Firefox, Safari, Edge, and Opera.
97%Browser support
Google Chrome10+ · Desktop & Mobile
Full support
Mozilla Firefox4+ · Desktop & Mobile
Full support
Apple Safari5+ · macOS & iOS
Full support
Microsoft Edge12+ · All versions
Full support
Opera10.5+ · All versions
Full support
:default pseudo-class97% supported
Bottom line::default is reliable for modern form UIs; use :checked when you need the current selection regardless of HTML defaults.
Wrap Up
Conclusion
The :default pseudo-class lets you style form elements that are pre-selected in your HTML. It is a useful complement to :checked when you want to highlight the author’s recommended or factory-default choices.
Use it on radio buttons, checkboxes, and select options to improve form clarity. Pair visual styling with accessible labels and clear text so every user understands the default selections.
Use these points when styling default form controls.
5
Core concepts
★01
HTML default
Pre-selected.
Purpose
🔴02
Radio
checked attr.
Input
▼03
Option
selected attr.
Select
⇄04
vs :checked
Initial vs now.
Compare
🌐05
97% support
Modern browsers.
Compat
❓ Frequently Asked Questions
The :default pseudo-class matches form elements that are the default choice in their group — such as a radio button with the checked attribute, an option with selected, or the default submit button in a form.
input[type="checkbox"], input[type="radio"], option elements inside select, and submit/button inputs that serve as the default action in a form.
:default matches the element marked as the initial default in HTML. :checked matches whichever option is currently selected. After a user picks a different radio button, :checked moves but :default stays on the originally default element.
Yes. Use option:default to target the option with the selected attribute. Browser styling support for options can vary, so test in your target browsers.
Yes in all modern browsers. Chrome, Firefox, Safari, and Edge support :default. It is less common than :checked but safe for modern projects.