HTML and CSS Reference
In-Depth Information
Selector
Description
Example
Defined In
a:link
Specifies the unvisited
link
a:link {font-weight: bold;}
/* makes unvisited links bold
*/
CSS1
Specifies the link as it
is being pressed
CSS1
a:active
a:active {color: red;}
/* makes links red as they are
pressed */
Specifies the link after
being pressed
CSS1
a:visited
a:visited {text-decoration:
line-through;}
/* puts a line through visited
links */
:hover
Selects the element
when the user is
hovering over it
p:hover {background-color:
yellow;}
/* sets the background color
to yellow on the p element
that the user is currently
hovering over */
CSS2
:target
Selects the element
that is the target of a
referring URI
:target{color:red;}
/* if the element is the
target of the referring URI,
the color is set to red */
CSS3
:focus
Selects the element
only when the element
holds the focus
input:focus {background-color:
yellow;}
/* sets the background color
to yellow on the input element
that has focus */
CSS2
:enabled
Selects the elements
that are currently
enabled
input:enabled
{background-color: white;}
/* sets the background color
to white on enabled input
elements */
CSS3
Selects the elements
that are currently
disabled
CSS3
:disabled
input:disabled
{background-color: gray;}
/* sets the background color
to gray on disabled input
elements */
:checked
Selects the elements
that are checked
:checked{color: blue;}
/* sets the color to blue if
an element is checked */
CSS3
T ABLE 4-9 CSS Pseudo-Class Selectors
 
Search WWH ::




Custom Search