<label for="opt-in">I agree to receive emails</label>
<input type="checkbox" id="opt-in">
Rendered Output
<input type="checkbox" checked>
Rendered Output
<input type="checkbox" disabled>
Rendered Output
<form>
    <label for="opt-in">I agree to receive emails (required)</label>
    <!-- Specifies a required field using the required attribute -->
    <input type="checkbox" id="opt-in" required>
    <button type="submit">Submit</button>
</form>
Rendered Output Try clicking the 'Submit' button without checking the checkbox!
You will see the browser display an error message for a required field.
<form>
    <label for="opt-in">I agree to receive emails</label>
    <input type="checkbox" id="opt-in" name="opt-in" value="email-checked">
    <button type="submit">Submit</button>
</form>
<fieldset>
    <legend>Select the web development languages you are interested in.</legend>
    <div>
       <input type="checkbox" id="html" name="favorite" value="html">
       <label for="html">HTML</label>
    </div>
    <div>
       <input type="checkbox" id="css" name="favorite" value="css">
       <label for="css">CSS</label>
    </div>
    <div>
       <input type="checkbox" id="js" name="favorite" value="js">
       <label for="js">JavaScript</label>
    </div>
</fieldset>
Rendered Output
<input type="checkbox">
<input type="radio">
Rendered Output Try the following example yourself.
<fieldset>
    <legend>Select the web development languages you are interested in.</legend>
    <div>
       <input type="checkbox" id="html" name="interest" value="html">
       <label for="html">HTML</label>
    </div>
    <div>
       <input type="checkbox" id="css" name="interest" value="css">
       <label for="css">CSS</label>
    </div>
    <div>
       <input type="checkbox" id="js" name="interest" value="js">
       <label for="js">JavaScript</label>
    </div>
</fieldset>
Grouped checkboxes allow multiple selections.
<fieldset>
    <legend>Select the web development languages you are interested in.</legend>
    <div>
       <input type="radio" id="html" name="interest" value="html">
       <label for="html">HTML</label>
    </div>
    <div>
       <input type="radio" id="css" name="interest" value="css">
       <label for="css">CSS</label>
    </div>
    <div>
       <input type="radio" id="js" name="interest" value="js">
       <label for="js">JavaScript</label>
    </div>
</fieldset>
Only one option can be selected at a time in a radio button group.