How to animate a text in HTML
Code of index.html:
<!DOCTYPE html>
<html lang="es">
<head>
<title>Index</title>
<meta charset="utf-8">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<span class="text1">welcome In</span>
<span class="text2">Code Creator</span>
</div>
</body>
</html>
Code of style.css:
*{
padding: 0;
margin: 0;
font-family: sans-serif;
}
body{
background-color: white;
}
.container{
text-align: center;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
width: 100%;
}
.container span{
text-transform: uppercase;
display: block;
}
.text1{
color: #444;
font-size: 60px;
font-weight: 700;
letter-spacing: 8px;
margin-bottom: 20px;
background-color: white;
position: relative;
animation: text 3s 1;
}
.text2{
color: #444;
font-size: 20px;
font-weight: 700;
letter-spacing: 8px;
margin-bottom: 20px;
background-color: white;
position: relative;
animation: text 3s 1;
}
@keyframes text{
0%{
color: white;
}
30%{
letter-spacing: 25px;
}
85%{
letter-spacing: 8px;
}
}
Comentarios
Publicar un comentario