how to hover in css code example
Example 1: css hover
.a:hover{background-color: black;}
Example 2: on hover css
/* Changes an element's color on hover */
.selector {
background-color: black;
}
.selector:hover {
background-color: blue;
}
Example 3: hover css
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>CSS :hover property</title>
<style>
a {
background-color: powderblue;
transition: background-color 0.5s;
}
a:hover {
background-color: gold;
}
</style>
</head>
<body>
<a href="#">Try hovering over this link.</a>
</body>
</html>