We would like to know how to make a hover effect for pseudo elements.
<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
#button {<!--from www .java 2 s . c om-->
display: block;
height: 25px;
margin: 0 10px;
padding: 10px;
text-indent: 20px;
width: 12%;
}
#button:before {
background-color: blue;
content: "";
display: block;
height: 25px;
width: 25px;
}
#button:hover:before {
background-color: red;
}
</style>
</head>
<body>
<div id="button">Button</div>
</body>
</html>
The code above is rendered as follows: