<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Animate text JavaScript</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<div class="section-one-text">
<strong class="taille">
Si vous voulez faire <br> une oeuvre durable, <br> Soyez
<span class="anime"></span>
</strong>
<div>
<button><span class="hov"></span>Nous contacter</button>
<button><span class="hov"></span>Blog</button>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/typed.js@2.0.11"></script>
<script>
var typed = new Typed('.anime', {
strings:[
'bons',
'patients',
'humains',
'vivables'
],
typeSpeed: 100,
backSpeed: 70,
loop: true
})
</script>
</body>
</html>
*{
box-sizing: border-box;
padding: 0;
margin: 0;
}
body{
font-family: 'Montserrat';
line-height: 1.6;
}
.container{
margin: 0 auto;
overflow: auto;
background-image: linear-gradient(rgb(0, 0, 0, 0.70), rgb(0, 0, 0, 0.70)), url('./image/bg.jpg');
background-size: cover;
background-repeat: no-repeat;
width: 100%;
height: 100vh;
}
.section-one-text{
position: absolute;
top: 40%;
left: 25%;
transform: translateY(-50%);
text-align: center;
}
.taille{
font-size: 4rem;
color: #fff;
font-weight: bold;
}
.section-one-text strong span{
color: #0fb294;
}
button{
width: 200px;
padding: 15px 0;
text-align: center;
margin: 20px 10px;
border-radius: 25px;
border: 2px solid #f44336;
cursor: pointer;
color: #fff;
font-size: 1rem;
font-weight: bold;
background: transparent;
position: relative;
overflow: hidden;
outline: none;
}
.hov{
background: #f44336;
height: 100%;
width: 0;
border-radius: 20px;
position: absolute;
left: 0;
top: 0;
z-index: -1;
transition: 0.5s;
}
button:hover .hov{
width: 100%;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.