Home > OS >  Menu position sticky not working (bootstrap)
Menu position sticky not working (bootstrap)

Time:10-23

I've tried everything but my sticky position is not working, there is no parent element with overflow, I put the top:30%

#games-container #pills-tab {
    -webkit-backdrop-filter: blur( 5px );
    backdrop-filter: blur( 5px );
    background: rgba( 30, 30, 30, 0.5 );
    border-radius: 10rem;
    border: 1px solid rgba( 255, 255, 255, 0.18 );
    height: fit-content;
    padding: 1rem;
    top: 30%;
    width: 60%;
}

#games-container .nav-item {
    padding: .5rem;
}

#games-container .nav-item .nav-link.active {
    background-color: #FFC85D;
    color: #1E1E1E;
}

#games-container .nav-item .nav-link {
    background-color: #545454;
    border-radius: 10rem;
    color: #FFFFFF;
    transition: .5s;
}

#games-container .nav-item .nav-link:hover {
    color: #1E1E1E;
}
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"/>
  <ul  id="pills-tab" role="tablist">
                    <li  role="presentation">
                        <button  id="pills-destaques-tab" data-bs-toggle="pill" data-bs-target="#pills-destaques" type="button" role="tab" aria-controls="pills-destaques" aria-selected="true">Destaques</button>
                    </li>
                    <li  role="presentation">
                        <button  id="pills-aventura-tab" data-bs-toggle="pill" data-bs-target="#pills-aventura" type="button" role="tab" aria-controls="pills-aventura" aria-selected="false">Aventura</button>
                    </li>
                    <li  role="presentation">
                        <button  id="pills-acao-tab" data-bs-toggle="pill" data-bs-target="#pills-acao" type="button" role="tab" aria-controls="pills-acao" aria-selected="false">Ação</button>
                    </li>
                    <li  role="presentation">
                        <button  id="pills-coop-tab" data-bs-toggle="pill" data-bs-target="#pills-coop" type="button" role="tab" aria-controls="pills-coop" aria-selected="false">Cooperativo</button>
                    </li>
                    <li  role="presentation">
                        <button  id="pills-fps-tab" data-bs-toggle="pill" data-bs-target="#pills-fps" type="button" role="tab" aria-controls="pills-fps" aria-selected="false">FPS</button>
                    </li>
                    <li  role="presentation">
                        <button  id="pills-luta-tab" data-bs-toggle="pill" data-bs-target="#pills-luta" type="button" role="tab" aria-controls="pills-luta" aria-selected="false">Luta</button>
                    </li>
                    <li  role="presentation">
                        <button  id="pills-rpg-tab" data-bs-toggle="pill" data-bs-target="#pills-rpg" type="button" role="tab" aria-controls="pills-rpg" aria-selected="false">RPG</button>
                    </li>
                    <li  role="presentation">
                        <button  id="pills-terror-tab" data-bs-toggle="pill" data-bs-target="#pills-terror" type="button" role="tab" aria-controls="pills-terror" aria-selected="false">Terror</button>
                    </li>
                </ul>
  <div>
            <h1>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Nam asperiores eum, sed odit minus facilis tenetur, fugit non quas nisi fugiat et? Hic in facilis distinctio saepe modi. Nisi, corporis!</h1>
        </div>
  <div>
            <h1>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Nam asperiores eum, sed odit minus facilis tenetur, fugit non quas nisi fugiat et? Hic in facilis distinctio saepe modi. Nisi, corporis!</h1>
        </div>
  <div>
            <h1>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Nam asperiores eum, sed odit minus facilis tenetur, fugit non quas nisi fugiat et? Hic in facilis distinctio saepe modi. Nisi, corporis!</h1>
        </div>
  <div>
            <h1>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Nam asperiores eum, sed odit minus facilis tenetur, fugit non quas nisi fugiat et? Hic in facilis distinctio saepe modi. Nisi, corporis!</h1>
        </div>  <div>
            <h1>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Nam asperiores eum, sed odit minus facilis tenetur, fugit non quas nisi fugiat et? Hic in facilis distinctio saepe modi. Nisi, corporis!</h1>
        </div>
  <div>
            <h1>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Nam asperiores eum, sed odit minus facilis tenetur, fugit non quas nisi fugiat et? Hic in facilis distinctio saepe modi. Nisi, corporis!</h1>
        </div>
  <div>
            <h1>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Nam asperiores eum, sed odit minus facilis tenetur, fugit non quas nisi fugiat et? Hic in facilis distinctio saepe modi. Nisi, corporis!</h1>
        </div>
  <div>
            <h1>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Nam asperiores eum, sed odit minus facilis tenetur, fugit non quas nisi fugiat et? Hic in facilis distinctio saepe modi. Nisi, corporis!</h1>
        </div>
  <div>
            <h1>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Nam asperiores eum, sed odit minus facilis tenetur, fugit non quas nisi fugiat et? Hic in facilis distinctio saepe modi. Nisi, corporis!</h1>
        </div>
  <div>
            <h1>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Nam asperiores eum, sed odit minus facilis tenetur, fugit non quas nisi fugiat et? Hic in facilis distinctio saepe modi. Nisi, corporis!</h1>
        </div>
  <div>
            <h1>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Nam asperiores eum, sed odit minus facilis tenetur, fugit non quas nisi fugiat et? Hic in facilis distinctio saepe modi. Nisi, corporis!</h1>
        </div>
  <div>
            <h1>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Nam asperiores eum, sed odit minus facilis tenetur, fugit non quas nisi fugiat et? Hic in facilis distinctio saepe modi. Nisi, corporis!</h1>
        </div>
  <div>
            <h1>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Nam asperiores eum, sed odit minus facilis tenetur, fugit non quas nisi fugiat et? Hic in facilis distinctio saepe modi. Nisi, corporis!</h1>
        </div>

CodePudding user response:

If you want you nav to stick you can just add the {top:0} code to your .nav using css... Add this code in your CSS file and it should fix your problem:

.nav{top: 0;}
  • Related