webdevlinux - logo Web Dev Linux


We use the checkboxes to choose multiple options from a group of options. Here you will understand how to use checkboxes in an HTML document.

HTML checkboxes Checkboxes

Try the example given below.

FILE : checkboxes.html
<!DOCTYPE html>
<meta charset="utf-8" />
<p>Select the operating systems you have used.</p>
<label><input type="checkbox"> Arch</label><br>
<label><input type="checkbox"> Debian</label><br>
<label><input type="checkbox" checked> Fedora</label><br>
<label><input type="checkbox"> Gentoo</label><br>
<label><input type="checkbox"> Mint</label><br>
<label><input type="checkbox"> Ubuntu</label><br>


Take a look at the explanation of elements & attributes used in the example.

<input type="checkbox">
The input element with the type value checkbox defines a toggled option.
The checked attribute is used to represents a pre-selected option.