CSS hover is used to enhance the user experience. We can change the appearance or the behaviour of the HTML element(s) when the user hovers over it.
Syntex
<style>
selector:hover {
/* CSS rules(s) */;
}
</style>
Example 1
<html lang="en">
<head>
<style>
#p1{
color: yellow;
}
#p1:hover{
color: red;
}
#p2 {
border: 2px solid red;
}
#p2:hover{
border: 5px solid purple;
}
</style>
</head>
<body>
<p id="p1">CodeWithRahul</p>
<p id="p2">Developers are Founder of rahul3133.github.io/codewithrahul/htmls/index.html</p>
</body>
</html>
Output: