Hover Effect Button
<!-- HTML -->
<button class="hover-button">Hover Me!</button>
/* CSS */
.hover-button {
padding: 15px 30px;
font-size: 18px;
background-color: #3498db;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
transition: all 0.3s ease;
}
.hover-button:hover {
background-color: #2980b9;
transform: scale(1.1);
box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
Explanation:
- The button uses a
transition
property to create smooth animations.
- On hover, three effects occur:
- Background color darkens
- Button scales up by 10%
- Shadow appears for depth
- The
cursor: pointer
property changes the cursor to a hand when hovering.
- Border-radius adds rounded corners to the button.
Try it yourself:
0 Comments