HTML and CSS Reference
In-Depth Information
selecting the input field directly. The following code will set the same
text color for all the text and form elements:
body, input, select, fieldset {
color: #666;
}
Though not supported in IE7 or earlier, this is a great use case for the
inherit value to explicitly tell form elements to inherit certain proper-
ties from their parents.
input, select, fieldset {
color: inherit;
}
States: Disabled, Required, and Invalid
Chapter 3 introduced the :disabled , :checked , :required , :valid , and
:invalid pseudo-class selectors. The browser support for these selectors
might put them in the unreliable category—particularly since forms are
so important to some web apps or marketing programs and thus tend
to strive for more cross-browser consistency. These selectors also apply
only to form elements and not to other parts of the form presentation
like labels that often need to reflect the same state. To get around this
limitation, it can be useful to create classes that mimic the effect of the
pseudo-class selectors.
label.required {
font-weight: bold;
}
p.errorDetails,
label.invalid,
input.invalid,
(continues on next page)
 
 
Search WWH ::




Custom Search