Button Border Animation Using SVG
Button Border Animation
<style>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
body{
background-color: #2a2a2a;
display: flex;
min-height: 100vh;
justify-content: center;
align-items: center;
}
.svgbtn a{
font-size: xx-large;
color: white;
display: flex;
text-decoration: none;
position: absolute;
justify-content: center;
flex-direction: row;
align-items: center;
text-align: center;
width: 180px;
height: 70px;
}
a svg, a svg rect{
position: absolute;
fill: transparent;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
a svg rect{
stroke: white;
stroke-width: 4px;
transition: .5s;
stroke-dasharray: 600,600;
stroke-dashoffset: 0;
}
a:hover svg rect{
stroke-dasharray: 100,400;
stroke-dashoffset: 210;
}
.wrapper{
display: flex;
justify-content: space-between;
align-items: center;
}
</style>
<body>
<div class="wrapper">
<div class="svgbtn">
<a href="">
<svg>
<rect>
</rect>
</svg>
Click Here</a>
</div>
</div>
</body>