پیشنمایش زنده
کد HTML
<div class="custom-post">
<div class="box-2">
<div class="btn btn-two" aria-label="Hover to see effects">
<span>HOVER ME</span>
</div>
</div>
</div>
کد CSS
.custom-post {
width: 100%;
height: 100%;
overflow: hidden;
margin: 0;
display: flex;
justify-content: center;
flex-direction: column;
flex-wrap: wrap;
font-family: "Open Sans Condensed", sans-serif;
}
.custom-post div[class*="box"] {
height: 33.33%;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.custom-post .btn {
line-height: 50px;
height: 50px;
text-align: center;
width: 250px;
cursor: pointer;
border-radius: 25px;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
font-size: 18px;
font-weight: bold;
transition:
transform 0.3s,
box-shadow 0.3s;
}
.custom-post .btn-two {
color: #fff;
position: relative;
overflow: hidden;
}
.custom-post .btn-two span {
z-index: 2;
display: block;
position: relative;
}
.custom-post .btn-two::before,
.custom-post .btn-two::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
transition: all 0.5s;
border: 1px solid rgba(255, 255, 255, 0.2);
background-color: rgba(255, 255, 255, 0.1);
border-radius: 25px;
}
.custom-post .btn-two::before {
transform: rotate(0deg);
}
.custom-post .btn-two::after {
transform: rotate(0deg);
}
.custom-post .btn-two:hover {
transform: translateY(-5px);
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}
.custom-post .btn-two:hover::before {
transform: rotate(-45deg);
background-color: rgba(255, 255, 255, 0);
}
.custom-post .btn-two:hover::after {
transform: rotate(45deg);
background-color: rgba(255, 255, 255, 0);
}