SPACEBAR to move forward through slides.
SHIFT & SPACEBAR to move backwards through slides.
LEFT ARROW & RIGHT ARROW to move through sections.
ESC to see overview and ESC again to exit.
F to enter presentation mode and ESC to exit.
User interface pseudo-classes allow you to style various aspects of form-related elements.
The :disabled pseudo-class selector is written using an element followed by ":"
, followed by "disabled"
.
/* syntax */
E:disabled { }
/* example */
input:disabled { }
Whitespace is not permitted within the selector.
/* Valid */
input:disabled { }
/* Invalid */
input: disabled { }
The :disabled pseudo-class selector targets form controls that use the disabled
attribute.
In the following example, only the input element that has a disabled
attribute will be selected.
/* CSS selector */
input:disabled { }
<!-- HTML markup -->
<input type="text" disabled>
<input type="text">
W3C Selectors Level 4
Status: Working Draft
W3C CSS Basic User Interface Module Level 3
Status: Proposed Recommendation
Selectors Level 3
Status: Recommendation
The :disabled pseudo-class selector is not supported by IE6, IE7 or IE8.
Open this HTML file in an editor:
exercises-start/exercise-205-08-01.html
Write a CSS rule to style the <input>
with a boolean disabled
attribute. Set with border: 1px solid red
.
/* Add styles here */
input:disabled {
border: 1px solid red;
}
Check your work against the finished HTML file:
exercises-finished/exercise-205-08-01.html
The :enabled pseudo-class selector is written using an element followed by ":"
, followed by "enabled"
.
/* syntax */
E:enabled { }
/* example */
input:enabled { }
Whitespace is not permitted within the selector.
/* Valid */
input:enabled { }
/* Invalid */
input: disabled { }
The :enabled pseudo-class selector targets form controls that do not use the disabled
attribute.
In the following example, only the input element that does not have a disabled
attribute will be selected.
/* CSS selector */
input:disabled { }
<!-- HTML markup -->
<input type="text" disabled>
<input type="text">
W3C Selectors Level 4
Status: Working Draft
W3C CSS Basic User Interface Module Level 3
Status: Proposed Recommendation
Selectors Level 3
Status: Recommendation
The :disabled pseudo-class selector is not supported by IE6, IE7 or IE8.
Open this HTML file in an editor:
exercises-start/exercise-205-08-02.html
Write a CSS rule to style any <input>
that does not have a boolean disabled
attribute. Set with border: 1px solid green
.
/* Add styles here */
input:enabled {
border: 1px solid green;
}
Check your work against the finished HTML file:
exercises-finished/exercise-205-08-02.html
The :checked pseudo-class selector is written using an element followed by ":"
, followed by "checked"
.
/* syntax */
E:checked { }
/* example */
input[type=radio]:checked { }
Whitespace is not permitted within the selector.
/* Valid */
input:checked { }
/* Invalid */
input: checked { }
The :checked pseudo-class selector targets radio button, checkbox, or option elements that use the checked
attribute.
The :checked pseudo-class selector also targets elements that have been checked or toggled to an “on” state by the user.
Users can toggle this state by checking/unchecking or selecting/deselecting an element.
In the following example, initially, only the input element that has a checked
attribute will be selected.
/* CSS selector */
input:checked { }
<!-- HTML markup -->
<input type="radio" checked>
<input type="radio">
W3C Selectors Level 4
Status: Working Draft
W3C CSS Basic User Interface Module Level 3
Status: Proposed Recommendation
Selectors Level 3
Status: Recommendation
The :checked pseudo-class selector is not supported by IE6, IE7 or IE8.
Open this HTML file in an editor:
exercises-start/exercise-205-08-03.html
Write a CSS rule to style the label
that comes after (or is adjacent to) an <input>
that has the boolean checked
attribute.
Set the color
value to seagreen
.
/* Add styles here */
input:checked + label {
color: seagreen;
}
Check your work against the finished HTML file:
exercises-finished/exercise-205-08-03.html
The :indeterminate pseudo-class selector is written using an element followed by ":"
, followed by "indeterminate"
.
/* syntax */
E:intermediate { }
/* example */
input:intermediate { }
Whitespace is not permitted within the selector.
/* Valid */
input:intermediate { }
/* Invalid */
input: intermediate { }
By default, checkboxes and radio buttons only display two possible states - checked or unchecked.
However, checkbox inputs can have three possible visible states: checked, unchecked, or indeterminate.
For example, you may have a series of checkbox inputs that have child checkbox inputs.
Option 1: If none of the child inputs are checked, the parent input should also be displayed as unchecked.
Option 2: If all the child inputs are checked, the parent input should also be displayed as checked.
Option 3: If only some of the child inputs are checked, the parent input could be displayed as indeterminate.
The only way to make a checkbox display in this indeterminate state is by using JavaScript.
The :intermediate pseudo-class selector targets radio buttons or checkboxes that are in this indeterminate state.
In the following example, the label of any checkbox that is in the indeterminate state would be selected.
/* CSS selector */
input:indeterminate + label { }
W3C Selectors Level 4
Status: Working Draft
W3C CSS Basic User Interface Module Level 3
Status: Proposed Recommendation
The :indeterminate pseudo-class selector is not supported by IE6, IE7 or IE8.
Site Twitter Github Slideshare Linkedin