JSFiddle - React, Tailwind, and code Playground
HTML
<div class="bg">
<h1>
<em class="text-wrapper">
<em class="text">Эффект</em>
</em>
<em class="text-wrapper">
<em class="text">Новая строка</em>
</em>
</h1>
</div>
CSS
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body {
margin:0;
}
.bg {
background: url('https://images.unsplash.com/photo-1570651850441-090417e4f3f6?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2125&q=80');
position: relative;
width: 100vw;
height: 100vh;
background-size: 100%;
background-repeat: no-repeat;
}
h1 {
font-size: 5rem;
color: #222;
line-height: 1.5;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
h1 em {
white-space: nowrap;
}
.text-wrapper{
overflow: hidden;
display: block;
}
.text{
transition: transform .4s ease-in-out;
display: inline-block;
transform: translateY(100%);
}
h1 .text-wrapper:nth-of-type(1) .text{
transition-delay: .0s;
}
h1 .text-wrapper:nth-of-type(2) .text{
transition-delay: .1s;
}
h1:hover .text {
transform: translateY(0%);
}