<!-- https://webdevtrick.com/css-text-hover-effect/ -->
<!-- Code By WebDevTrick ( https://webdevtrick.com ) -->
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Hover Animation | Web Dev Trick</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="svg-wrapper">
<svg height="60" width="320" xmlns="http://www.w3.org/2000/svg">
<rect class="shape" height="60" width="320" />
<div class="text">WEBDEVTRICK</div>
</svg>
</div>
</body>
</html>
/**
code by WebDevTrick (https://webdevtrick.com)
**/
html,
body {
background: rgb(20, 20, 20);
text-align: center;
height: 100%;
overflow: hidden;
}
.svg-wrapper {
position: relative;
top: 50%;
transform: translateY(-50%);
margin: 0 auto;
width: 320px;
}
.shape {
stroke-dasharray: 140 540;
stroke-dashoffset: -474;
stroke-width: 8px;
fill: transparent;
stroke: red;
border-bottom: 5px solid black;
transition: stroke-width 1s, stroke-dashoffset 1s, stroke-dasharray 1s;
}
.text {
font-family: 'Roboto Condensed';
font-size: 22px;
line-height: 32px;
letter-spacing: 8px;
color: #fff;
top: -48px;
position: relative;
}
.svg-wrapper:hover .shape {
stroke-width: 2px;
stroke-dashoffset: 0;
stroke-dasharray: 760;
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.