I'm currently working on a text slide-in animation, but I'm facing an issue where the text doesn't stack properly on small screens and ends up running off the screen. I want the two sentences to be on the same line for large and extra-large screens, but stack on smaller screens. Right now, it's stacking regardless of screen size and looks fine on medium screens and up, but poses a problem on small screens. Any suggestions on what I can do to fix this?
Screenshots: Full screen Small screen
body {
text-align: center;
background: linear-gradient(141deg, #ccc 25%, #eee 40%, #ddd 55%);
color: #555;
font-weight: 300;
font-size: 32px;
padding-top: 40vh;
height: 100vh;
overflow: visible;
-webkit-backface-visibility: hidden;
-webkit-perspective: 1000;
-webkit-transform: translate3d(0, 0, 0);
}
.intro {
display: inline-block;
overflow: hidden;
white-space: normal;
}
.intro:first-of-type {
animation: showup 7s infinite;
}
.intro~.intro {
width: 0px;
animation: reveal 7s infinite;
white-space: normal;
}
.intro~.intro span {
margin-left: -355px;
animation: slidein 7s infinite;
white-space: normal;
}
@keyframes showup {
0% {
opacity: 0;
}
20% {
opacity: 1;
}
80% {
opacity: 1;
}
100% {
opacity: 0;
}
}
@keyframes slidein {
0% {
margin-left: -800px;
}
20% {
margin-left: -800px;
}
35% {
margin-left: 0px;
}
100% {
margin-left: 0px;
}
}
@keyframes reveal {
0% {
opacity: 0;
width: 0px;
}
20% {
opacity: 1;
width: 0px;
}
30% {
width: 650px;
}
80% {
opacity: 1;
}
100% {
opacity: 0;
width: 650px;
}
}
p {
font-size: 12px;
color: #999;
}
<div class="container-fluid">
<div class="intro">Hello.</div>
<div class="intro col-xs-12">
<span>My name is Nate and I need this responsive</span>
</div>
</div>