Source Code
HTML-CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Baloo+Bhaijaan+2:wght@400;500;600;800&display=swap" rel="stylesheet">
<title>Document</title>
</head>
<body>
<div class="container">
<div class="btn">
<span>Button Hover</span>
</div>
</div>
</body>
</html>
CSS-CODE
* {
margin: 0;
padding: 0;
font-family: 'Baloo Bhaijaan 2', cursive;
width: 200px;
margin: 0 auto;
}
.container {
text-align: center;
margin-top: 360px;
}
.btn {
display: inline-block;
padding: 10px 40px;
border: 1px solid #000;
border-radius: 10px;
font-size: 20px;
font-weight: 600;
cursor: pointer;
position: relative;
}
.btn:hover {
background-color: #000;
color: #fff;
}
.btn::before {
content: "";
position: absolute;
top: 6px;
left: -2px;
width: calc(100% + 4px);
height: calc(100% - 12px);
background-color: #fff;
transform: scaleY(1);
transition: all .5s ease;
}
.btn:hover::before {
transform: scaleY(0);
}
.btn::after {
content: "";
position: absolute;
top: -2px;
left: 6px;
width: calc(100% - 12px);
height: calc(100% + 4px);
background-color: #fff;
transform: scaleX(1);
transition: all .5s ease;
}
.btn:hover::after {
transform: scaleX(0);
}
.btn span {
position: relative;
z-index: 99;
}
0 Comments