Your Ad Here

Pseudo-class selectors


Pseudo-class selectors let you select elements that are not part of the document
tree, but rather are events or qualities of certain elements.
Link pseudo-classes
You use link pseudo-classes to target link text in its various states.
■ :link targets an unvisited link
■ :visited targets a visited link
Dynamic pseudo-classes
These pseudo-classes are typically used on the link element, but you can apply
them to any element on the page as well.
■ :focus targets any element that is in focus
■ :hover targets any element that is being selected by a pointing device
(such as a cursor)
■ :active targets any element that is activated by the user (such as
an active link)

Th e order of these pseudo-classes is important as it mimics the cascade
that the browser follows, and most of the states are mutually exclusive.
For example, you must have a regular link state before you have a visited
link state.
Many people use the mnemonic LoVe For HAte to remember the order :link,
:visited, :focus, :hover, :active. Usually, all of the link styles are written
together:
a {color: #3f0;}
a:link {text-decoration: none;}
a:visited {color: #0f3;}
a:focus {text-decoration: none;}
a:active {color: #f03;}
a:hover {text-decoration: underline; color: #636;}

0 comments:

Post a Comment

Popular Posts

Recent posts