Monday 15 July 2013

Example of hover Selector or How To Set Hover Effect and Display Font in Differant way in CSS



Definition and Usage

The :hover selector is used to select elements when you mouse over them.
Tip: The :hover selector can be used on all elements, not only on links.
Hover property of CSS:-

            By using this property you can select elements when you mouse over them.

For Ex:-
            div.img a:hover img

  {

  border:1px solid #0000ff;

  height:110;

  width:150;

  }

You can also apply hover Effect not only <a> tag you can apply on any Element.


Example:-

<html>
<head>
<style type="text/css">
a.ex1:hover,a.ex1:active {color:red;}
a.ex2:hover,a.ex2:active {font-size:150%;}
a.ex3:hover,a.ex3:active {background:red;}
a.ex4:hover,a.ex4:active {font-family:monospace;}
a.ex5:visited,a.ex5:link {text-decoration:none;}
a.ex5:hover,a.ex5:active {text-decoration:underline;}
</style>
</head>

<body>
<p>Mouse over the links to see them change layout.</p>

<p><a class="ex1" href="#">This link changes color</a></p>
<p><a class="ex2" href="#">This link changes font-size</a></p>
<p><a class="ex3" href="#">This link changes background-color</a></p>
<p><a class="ex4" href="#">This link changes font-family</a></p>
<p><a class="ex5" href="#">This link changes text-decoration</a></p>
</body>

</html>


This entry was posted in :

0 comments:

Post a Comment