CSS :default
Pseudo-Class
The :default
pseudo-class in CSS selects form elements that are the default choice in a group, such as:
1. Syntax
✅ Targets the default option in forms, such as radio buttons, checkboxes, and buttons.
2. Example – Styling the Default Radio Button
✅ The pre-selected (default) radio button gets a red border.
3. Example – Styling the Default Checkbox
✅ The checked checkbox gets a blue glow.
4. Example – Styling the Default Submit Button
✅ The default submit button turns blue.
5. When to Use :default
?
✔ To highlight pre-selected form elements.
✔ To style default buttons differently.
✔ To improve accessibility and usability.
6. Browser Compatibility
✅ Supported in all modern browsers (Chrome, Firefox, Edge, Safari).