HTML and CSS Reference
In-Depth Information
Boolean indeterminate property accessible from JavaScript that can be set, which
will then trigger the applicability of this selector. Say you have a check box control:
<input id="undecided" type="checkbox" />
The id is then accessed from JavaScript to set the state of the check box to indeterm-
inate:
function setState() {
var
check
=
docu-
ment.getElementById("undecided");
check.indeterminate = true;
}
window.onload = setState;
With this script, the check box will be placed in the indeterminate state ( Figure 6-6 )
and can then have styles applied using the :indeterminate selector.
Figure 6-6. A check box in the indeterminate state
Note You may find the styles you can apply to check boxes are pretty boring.
Safari, Chrome, and Firefox don't support adding borders and background to the
check boxes. To see whether your styles are being applied, try setting the height, like
height:100px; . Any content around the check box should get pushed out of the
way.
The default: style will apply to elements designated as being the default within
a given context; for example, the initially checked radio button in a radio button group
may be considered the default. This one could be styled, and that style would stay with
the initially checked button, even if another radio button was clicked. Another scenario
is if there is more than one submit button on a form (which there really shouldn't be—but
this is just hypothetical!), one of those buttons will be considered the default submit but-
ton for the form. Unfortunately, what gets set to be the default varies from browser to
browser. For instance, Opera recognizes the first scenario with the radio buttons, while
Safari recognizes the second scenario, but neither recognizes both scenarios.
The last two selectors in this group, :in-range and :out-of-range , are for
elements that have a constraint on a range of values that can be input into them. For in-
stance, the number input form control has min and max attributes that set the range of
 
Search WWH ::




Custom Search