Checkboxes allow the user to toggle between two possible choices. They work like an on/off switch.
Checkboxes are created using the <INPUT> tag. When used to create checkboxes, the INPUT tag has three required attributes, TYPE, NAME, and VALUE, and two optional attribute, ID and CHECKED.
Sample HTML source for a checkbox:
<input type="checkbox" name="duties" value="filing" id="duties" checked="checked" />
See the table below for more examples of checkboxes.
The TYPE Attribute (required)
The TYPE attribute takes the value "checkbox" when used to create a checkbox.
The NAME Attribute (required)
The author of the form assigns a value to the NAME attribute. Choose names for checkboxes which are meaningful and which will not be confusing when combined with the VALUE attribute you assign to the checkbox. It is permissible to give a group of checkboxes the same name, as long as you assign them each a separate value.
The VALUE Attribute (required)
Use the VALUE attribute to specify what value should be sent to the CGI script when the checkbox is checked. If using checkboxes singly, it is often least confusing to give the checkbox the same VALUE as its NAME. If you are using a group of checkboxes with the same NAME, make sure each has its own VALUE assigned to it.
The ID Attribute (optional, but required by accessibility standards)
The ID attribute is used to explicitly associate the specific Input tag with a specific LABEL tag. ID attributes are unique within a page.
The CHECKED Attribute (optional)
The CHECKED attribute indicates that the checkbox which includes this attribute should appear on the browser's screen with the checkbox selected.
html paragraph examples to learning web design
ReplyDeleteP paragraph tag first-line font-size