Introduction
A CSS pseudo-class adds selectors that specify a special state of the element to be selected and used to add special effects to some selectors. A pseudo-class allows you to style Content Dynamically based on its position in the document or state.
Syntax
- selector: pseudo-class { property: value; }
- selector: pseudo-element {property: value}
- selector. class: pseudo-element {property: value}
The most-commonly used pseudo-classes are-
- : link pseudo-class: The given example shows how to use the: link class to set the link color. Possible values could be any color name in the valid format.
Example
- <html>
- <head>
- <style type="text/css">
- a: link {color: red}
- </style>
- </head>
- <body>
- <a href="">Pseudo class with link property</a>
- </body>
- </html>
Output: The preceding code produces the following Red link.
- : visited pseudo-class: The given example shows how to use the:visited class to set the link color. Possible values could be any color name in the valid format.
Example
Output: The preceding code produces the following link. When you click this link it will change its color to Red.- <html>
- <head>
- <title></title>
- <style type="text/css">
- a: visited {color: red}
- </style>
- </head>
- <body>
- <a href="#" class="a1">Click this link</a>
- </body>
- </html>


- :hover pseudo-class: The given example shows how to use the :hover class to change the color of links from Blue to Green when we hover a mouse pointer over that link.
Example
Output: The preceding code produces the following link, when you click this link it will change its color to Green.- <html>
- <head>
- <title></title>
- <style type="text/css">
- a: hover {color: green}
- </style>
- </head>
- <body>
- <a href="#" class="a1">Bring mouse on me</a>
- </body>
- </html>

- : active pseudo-class: The given example shows how to use the: hover class to change the color of links from Blue to Green when we hover the mouse pointer over that link.
Example
Output: The preceding code produces the following link. When you click this link it will change its color to Green only for the activation of link:- <html>
- <head>
- <title></title>
- <style type="text/css">
- a: active {color: green}
- </style>
- </head>
- <body>
- <a href="#" class="a1">Please activate me</a>
- </body>
- </html>




Prasanna MuraliPosted May 20, 2016, 11:25 AM
Nice one....
Yashwanth MuthineniPosted Aug 22, 2015, 7:32 AM
Nice Share
Afzaal Ahmad ZeeshanPosted Aug 19, 2015, 7:04 AM
I thought they were called "Pseudo-selectors".
Santhakumar MunuswamyPosted Aug 18, 2015, 2:26 PM
Good one
Chervine BhiwooPosted Aug 18, 2015, 11:23 AM
Good work!
Manas MohapatraPosted Aug 18, 2015, 8:58 AM
Good Share..
Sibeesh VenuPosted Aug 18, 2015, 8:15 AM
Nice Share
Gopi ChandPosted Aug 18, 2015, 5:29 AM
Good effort
Nilesh JadavPosted Aug 18, 2015, 5:16 AM
Nice one sir
Rajeesh MenothPosted Aug 18, 2015, 4:28 AM
Nice One
Karthikeyan KPosted Aug 18, 2015, 4:12 AM
Thanks for sharing sir