Example of HTML checkboxes and radio buttons - HTML CSS HTML

HTML CSS examples for HTML:Form

Description

Example of HTML checkboxes and radio buttons

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html lang="en">
 <head> 
  <title>Example of HTML checkboxes and radio buttons</title> 
 </head> <!--from  w  w  w .j  a  va 2 s  . c  o m-->
 <body> 
  <form method="post" action=""> 
   <fieldset> 
    <legend>Hobbies</legend> 
    <input type="checkbox" name="hobby" value="sports" id="sport"> 
    <label for="sport">Sports</label> 
    <input type="checkbox" name="hobby" value="music" id="music"> 
    <label for="music">Music</label> 
    <input type="checkbox" name="hobby" value="reading" id="read"> 
    <label for="read">Reading</label> 
   </fieldset> 
   <fieldset> 
    <legend>Gender</legend> 
    <input type="radio" name="gender" value="male" id="male"> 
    <label for="male">Male</label> 
    <input type="radio" name="gender" value="female" id="female"> 
    <label for="female">Female</label> 
   </fieldset> 
  </form>   
 </body>
</html>

Related Tutorials