Hover effect
It has always been a collection of fun CSS effects, but today it is used on the front page of TDF, and a simple CSS effect may give you a neckbeard.Let’s start with the renderingsOn the code (can be directly pasted to use oh) HTML code
<a
href="http://tech.taiji.com.cn/tdfcloud/"
style="color: #fff; text-decoration:none"
target="_blank"
class="draw-border"
><button>HOVER ME</button>
</a>
Copy the code
CSS code
#draw-border {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}
button {
border: 0;
background: none;
text-transform: uppercase;
color: #fff;
font-weight: bold;
position: relative;
outline: none;
padding: 10px 20px;
box-sizing: border-box;
}
button::before,
button::after {
box-sizing: inherit;
position: absolute;
content: "";
border: 2px solid transparent;
width: 0;
height: 0;
}
button::after {
bottom: 0;
right: 0;
}
button::before {
top: 0;
left: 0;
}
button:hover::before,
button:hover::after {
width: 100%;
height: 100%;
}
button:hover::before {
border-top-color: #1890ff;
border-right-color: #1890ff;
transition: width 0.3s ease-out, height 0.3s ease-out 0.3s;
}
button:hover::after {
border-bottom-color: #1890ff;
border-left-color: #1890ff;
transition: border-color 0s ease-out 0.6s, width 0.3s ease-out 0.6s,
height 0.3s ease-out 1s;
}
Copy the code
Results 2The HTML code
<div id="border-btn">
<button>Hover me</button>
</div>
Copy the code
CSS code
<style lang="scss">
#border-btn {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}
button {
border: 0;
border-radius: 10px;
background: #2ec4b6;
text-transform: uppercase;
color: white;
font-size: 16px;
font-weight: bold;
padding: 15px 30px;
outline: none;
position: relative;
transition: border-radius 3s;
-webkit-transition: border-radius 3s;
}
button:hover {
border-bottom-right-radius: 50px;
border-top-left-radius: 50px;
border-bottom-left-radius: 10px;
border-top-right-radius: 10px;
}
</style>
Copy the code
Stuck_out_tongue_closed_eyes :~