How to use hover in Cascading Stylesheet

How to use hover in Cascading Stylesheet

In this article, you will learn How to use hover in Cascading Stylesheet.

Example:-

hover.html

<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css">
<title> Menus</title>
</head>
<body>
		<ul class="menu-1">
		<li><a href="#">UG Colleges</a></li>
		<li><a href="#">PG Colleges</a></li>
		<li><a href="#">Diploma Colleges</a></li>
		</ul>
</body>
</html>

style.css

li{
display:inline;
margin-left:20px;
}
li a:hover{
color:#fff;
background-color:green;
text-decoration:none;
padding:10px
}

Leave A Reply