<!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">
<title>Document</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="btn">
<Button>Hover Me!</Button>
<div class="box"></div>
<div class="box2"></div>
</div>
</body>
</html>
@import url("https://fonts.googleapis.com/css2?family=Poppins&display=swap");
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Poppins", sans-serif;
}
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.btn {
width: 130px;
height: 40px;
position: relative;
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
.btn button {
position: absolute;
width: 100%;
height: 100%;
border: none;
background: rgba(255, 255, 255, 0);
backdrop-filter: blur(20px);
color: rgba(0, 0, 0, 0.884);
cursor: pointer;
font-size: 0.95em;
transition: all 0.4s;
border-radius: 20px;
}
.btn button:hover {
color: white;
}
.box,
.box2 {
content: "";
position: absolute;
top: 10%;
left: -1.5%;
width: 100%;
height: 100%;
background: none;
z-index: -2;
border: 5px solid #0099f7;
border-radius: 20px;
transition: all 0.4s;
}
.btn button:hover ~ .box {
background: #f11712;
border: 5px solid #f11712;
top: -10%;
left: 1.5%;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.