Created
April 25, 2019 07:48
-
-
Save stanruss/6ee26e6b3b090dc4ec4643ca07290533 to your computer and use it in GitHub Desktop.
hover btn html css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="wrapper"> | |
<a href="#!" class="btn">hover me | |
<svg> | |
<rect></rect> | |
</svg> | |
</a> | |
</div> | |
*{ | |
padding: 0; | |
margin: 0; | |
} | |
.wrapper{ | |
width: 200px; | |
margin: 50px auto; | |
} | |
.btn{ | |
display: block; | |
width: 100%; | |
height: 70px; | |
line-height: 70px; | |
text-decoration: none; | |
color: black; | |
font-family: Arial; | |
text-transform: uppercase; | |
font-size: 28px; | |
letter-spacing: 3px; | |
position: relative; | |
text-align: center; | |
} | |
svg{ | |
position: absolute; | |
top: 0; | |
left: 0; | |
width: 100%; | |
height: 100%; | |
} | |
svg rect{ | |
fill: transparent; | |
stroke: black; | |
stroke-width: 5px; | |
stroke-dasharray: 10px 180px 20px 50px 20px 180px 20px 50px; | |
width: 100%; | |
height: 100%; | |
transition: .5s all; | |
} | |
.btn:hover rect{ | |
stroke-dasharray: 200px 0 70px 0 200px 0 70px 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment