Skip to content
Related Articles

Related Articles

Improve Article

How to add Radio Buttons in form using HTML ?

  • Last Updated : 22 Jul, 2021

We know that Radio Buttons are used to select only one option out of the several options. It is generally used in HTML form. 

Approach: To add a radio buttons in a webpage, the HTML provides a <input> element with type attribute is set to “radio”.  

Syntax:

<input type="radio">  

Example: Below code illustrates that how to add a radio button in the webpage. 

HTML




<!DOCTYPE html>
<html>
  
<head>
          
    <style>
        body {
            text-align: center;
        }
        h2 {
            color: green;
             
        }
    </style>
</head>
  
<body>
    <h2>
        GeeksforGeeks
    </h2>
  
    <h3>
        How to add a Radio Buttons in form using HTML?
    </h3>
    <h4>
    Select Gender
    </h4>
      
    Male
    <input type="radio" checked=true name="user_gender">
    Female
    <input type="radio"  name="user_gender">     
        
</body>
  
</html>                    

Output:

gender of user

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.




My Personal Notes arrow_drop_up
Recommended Articles
Page :