CSS | :default Selector
The :default selector is used to set a default element in a group of same type of element in a form. This selector is used on button, option, radio button and check-box.
Syntax:
:default {
//property
}
Example:
<!DOCTYPE html> <html> <head> <style> input[type="checkbox"]:default { box-shadow: 0 0 1px 1px gray; } </style> </head> <body> <h3>Select Language</h3> <form action=""> <input type="checkbox" name="lan" value="c" checked> C <br> <input type="checkbox" name="lan" value="c++"> C++ <br> <input type="checkbox" name="lan" value="java"> Java <br> <input type="checkbox" name="lan" value="c#"> C# <br> <input type="checkbox" name="lan" value="python"> Python <br> <input type="checkbox" name="lan" value="javascript"> JavaScript <br> </form> </body> </html> |
chevron_right
filter_none
Output:

Supported Browsers
Recommended Posts:
- HTML | default Attribute
- HTML | <track> default Attribute
- HTML | DOM Track default property
- How to set the default value for an HTML <select> element?
- How to set a default parameter value for a JavaScript function ?
- How to set textarea scroll bar to bottom as a default using JavaScript/jQuery ?
- CSS | ::before selector
- CSS | ::after Selector
- CSS | :not Selector
- CSS | * Selector
- CSS | #id Selector
- CSS | [attribute=value] Selector
- CSS | [attribute~=value] Selector
- CSS | [attribute|=value] Selector
- CSS | [attribute*=value] Selector
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



