I'm trying to color the bootstrap menu ... I found a beautiful animation, I use it and the animation starts to go outside the screen. If you put an absolute positioning, then you need to manually set the height, and this kills responsiveness, and if you set the height and width of the parent, then it leaves the screen
.bg { animation:slide 3s ease-in-out infinite alternate; background-image: linear-gradient(-60deg, #6c3 50%, #09f 50%); opacity:.5; position: absolute; height: 100%; right:-50%; left:-50%; } .bg2 { animation-direction:alternate-reverse; animation-duration:4s; } .bg3 { animation-duration:5s; } @keyframes slide { 0% { transform:translateX(-25%); } 100% { transform:translateX(25%); } } <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"> <nav class="navbar navbar-expand navbar-light bg-light"> <div class="bg"></div> <div class="bg bg2"></div> <div class="bg bg3"></div> <a class="navbar-brand" href="#">Navbar</a> <ul class="navbar-nav"> <li class="nav-item active"> <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a> </li> <li class="nav-item"> <a class="nav-link" href="#">Features</a> </li> <li class="nav-item"> <a class="nav-link" href="#">Pricing</a> </li> <li class="nav-item"> <a class="nav-link disabled" href="#">Disabled</a> </li> </ul> </nav>