During my project, I decided to incorporate some CSS animations onto the site. However, I encountered a problem with the overflow: hidden
attribute not functioning as anticipated. Here is the code snippet I used:
.jumbotron {
height: 100%;
height: 100vh;
align-items: center;
display: flex;
position: relative;
}
.sty {
display: inline-block;
position: relative;
}
.sty1 {
position: relative;
animation: firanim 1.5s ease-in-out;
overflow: hidden;
}
.sty2 {
position: relative;
animation: secanim 1s ease-in-out;
overflow: hidden;
}
@keyframes firanim {
from {top:-50px;}
to {top:0px;}
}
@keyframes secanim {
from {left:-55vw;}
to {left:0px;}
}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<link rel="stylesheet" href="css/style.css" type="text/css">
<!-- EndCSS -->
<title>lorem ipsum</title>
</head>
<body>
<nav class="navbar navbar-expand-sm navbar-dark bg-dark text-white sticky-top">
<a class="navbar-brand" href="#">Under Development</a>
<button class="navbar-toggler d-lg-none" type="button" data-toggle="collapse" data-target="#collapsibleNavId" aria-controls="collapsibleNavId"
aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse justify-content-end" id="collapsibleNavId">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Follow</a>
</li>
</ul>
</div>
</nav>
<div class="jumbotron justify-content-center">
<div class="text-monospace sty">
<h1 class="display-3">welcome<span class="text-danger">!</span></h1>
<div class="sty1">
<span class="lead">lorem ipsum lorem <span class="text-warning">LOREM IPSUM.</span></span>
</div>
<div class="sty2">
<span class="lead">lorem ipsum lorem ipsum lorem.</span>
</div>
</div>
</div>
<!-- JS -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
<!-- EndJS -->
</body>
</html>
Could you help me identify if there is a missing class in my code or if I am using something incorrectly? I expected the span
element with the .lead
class to remain within its designated space, rather than appearing to fly in from elsewhere. I hope I have conveyed my issue clearly.