<!DOCTYPE html>
<html>
<head>
<style>
button {
background: green;
color: white;
padding: 10px;
border: none;
cursor: pointer;
}
button:hover {
background: darkgreen; /* Changes color when hovered */
}
</style>
</head>
<body>
<button>Hover Me</button>
</body>
</html>
Explanation:
:hover
applies style when the mouse is over the element.
Leave a Reply