Skip to content
Related Articles

Related Articles

Improve Article

HTML <input type=”radio”>

  • Difficulty Level : Basic
  • Last Updated : 21 Sep, 2021
Geek Week

Example: In this example, we simply select the correct option from the given options using the radio button.

HTML




<!DOCTYPE html>
<html>
  
<body>
  
  <h2>Welcome To GeeksforGeeks</h2>
  <p>Select a Technology Brand:</p>
  <div>
    <input type="radio" id="Netflix" name="brand" value="Netflix">
    <label for="Netflix">Netflix</label>
  </div>
  
  <div>
    <input type="radio" id="Audi" name="brand" value="Audi">
    <label for="Audi">Audi</label>
  </div>
  
  <div>
    <input type="radio" id="Microsoft" name="brand" value="Microsoft" checked>
    <label for="Microsoft">Microsoft</label>
  </div>
  
</body>
  
</html>

Output:

The HTML <input type=”radio”> is used to define a Radio Button. Radio Buttons are used to let the user select exactly one option from a list of predefined options. Radio Button input controls are created by using the “input” element with a type attribute having value as “radio”.
Syntax: 
 

<input type="radio"> 

Example: 
 



HTML




<!DOCTYPE html>
<html>
  
<head>
  <title>
    HTML input type radio
  </title>
  
  <style>
    body {
      text-align: center;
    }
  
    h1 {
      color: green;
    }
  </style>
</head>
  
<body>
  <h1>
    GeeksforGeeks
  </h1>
  
  <h2>
    HTML <Input type= "radio">
  </h2>
  
  Radio Button:
  <input type="radio" checked=true id="radioID" value="Geeks_radio" 
         name="Geek_radio">
</body>
  
</html>

Output: 
 

Supported Browsers: 

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Safari
  • Opera
  • Edge 12 and above

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 :