This page has been flagged with the following issues:
Merge Candidate: This page is a candidate for merge with the following pages: [[html/attributes/type]]
The checkbox type of the <input> element represents a state or option that can be toggled.
Needs Examples: This section should include examples.
When an input type=checkbox element is selected, a name/value pair is submitted with the form. The default value of input type=checkbox is on. The height and width styles are exposed to the input type=checkbox element. The size of the element is set based on the values provided by the author, subject to a particular minimum. The size is calculated as follows:
- If the height or width is greater than 20 pixels, the padding around the check box is set to 4 pixels, and the inner height or width is set to 8 pixels.
- If the height or width is less than 20 pixels but greater than 13 pixels, the padding around the check box is equal to one half the specified height or width minus 13. For example, if the specified width of the check box is 17, the equation would be: (17-13)/2.
- If the height or width is less than 12 pixels, the padding around the check box is set to 0 and the inner width is set to the value specified by the author.
Note For code samples, see Form controls part 1 and Form controls part 2: validation on the Windows Internet Explorer sample site. In IE8 Standards mode and later, inserting an input type=checkbox object into the Document Object Model (DOM) tree does not reset the defaultChecked property. For more information, see Defining Document Compatibility.
- HTML 4.01 Specification, Section 17.4
|Feature||Chrome||Firefox (Gecko)||Internet Explorer||Opera||Safari|
|Feature||Android||BlackBerry||Chrome for mobile||Firefox Mobile (Gecko)||IE Mobile||Opera Mobile||Opera Mini||Safari Mobile|
Related pages (MSDN)
This article contains content originally from external sources.
Portions of this content come from the Microsoft Developer Network: [Windows Internet Explorer API reference Article]