How to use Css pseudo classes for html links

Posted by

How to use Css pseudo classes for html links

CSS pseudo class is said to be a keyword added to selectors which specifies a special state of element to be selected. Example: hover said to appy a style when user hovers over element specified by selector.

What are Pseudo-classes?

A pseudo-class is said to be used to define a special state of an element.

For example which can be used to:

  • Style is said to have an element when a user mouses over it
  • Style to have visited and unvisited links differently
  • Style will have element when it gets focus

/* unvisited link */
a:link {
color: #FF0000;

/* visited link */
a:visited {
color: #00FF00;

/* mouse over link */
a:hover {
color: #FF00FF;

/* selected link */
a:active {
color: #0000FF;


Leave a Reply

Your email address will not be published. Required fields are marked *