Button Hover Effect using Boxshadow property in HTML and CSS3
Smooth Button Hover Animation Effect
HTML CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Button hover effect</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<button class="name noselect">Hover Me!</button>
</body>
</html>
CSS Code(style.css)
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
height: 100vh;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
background-color: #4158D0;
background-image: linear-gradient(43deg, #4158D0 0%, #C850C0 46%, #FFCC70 100%);
}
.noselect {
-webkit-touch-callout: none;
-webkit-user-select: none;
user-select: none;
-webkit-tap-highlight-color: transparent;
}
button {
width: 150px;
height: 50px;
cursor: pointer;
font-size: 20px;
font-weight: bold;
color: black;
background: white;
border: 2px solid black;
box-shadow: 5px 5px 0 black,
-5px -5px 0 black,
-5px 5px 0 black,
5px -5px 0 black;
transition: 500ms ease-in-out;
}
button:hover {
box-shadow: 20px 5px 0 black, -20px -5px 0 black;
}
button:focus {
outline: none;
}
Comments
Post a Comment