Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

CSS | :default Selector

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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: 

HTML




<!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>

Output:

  

Supported Browsers:

  • Google Chrome 10.0
  • Edge 79.0
  • Firefox 4.0
  • Safari 5.0
  • Opera 10.0
My Personal Notes arrow_drop_up
Last Updated : 23 Aug, 2022
Like Article
Save Article
Similar Reads
Related Tutorials