html - how to make div element go under nav bar when scrolling up -


i trying make div elements below nav bar go under nav bar when scroll up. currently, contents go on nav bar when scroll up. tried using of solutions in stackoverflow somehow not work case. kindly appreciate help.

this html code:

<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">  <link rel="stylesheet"  href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0- alpha.2/css/bootstrap.min.css" integrity="sha384- y3tfxazxuh4hwsyylfb+j125mxis6mr5fohampbg064zb+afewh94ndvacbm8qnd"  crossorigin="anonymous">  <meta name="viewport" content="width=device-width, initial-scale=1">  <div class = "container-fluid">   <div class = "navigation-bar" id = "nav-bar">     <div class = "w3-top">     <div class = "w3-bar w3-border w3-card-4" >       <a href = "#" class="w3-bar-item w3-button">about</a>       <a href = "#" class="w3-bar-item w3-button">portfolio</a>       <a href = "#" class="w3-bar-item w3-button">contact</a>      </div>     </div>   </div>   <body>   <div class = "intro" id = "myintro">    <div class="w3-panel w3-card-4">     <h4 class = "header" align = "center"> workspace</h4>     <p>      <table style="width:90%">        <tr>          <td align = "center"><i>aspiring developer</i></td>          <td align = "center"><i>tech enthusiast</i>          <td align = "center"><i>loves fishing</i>        </tr>        </table>       </p>    <hr>   </div>  </div> 

this current css code:

.navigation-bar{   z-index: 1; } body {   padding: 50px;   z-index: -1; } h4 {   padding-top: 20px; } 

you can see happens through here: https://codepen.io/chawin/pen/ewbaxo

actually, in code, div element goes under nav bar. appears "go over" because nav bar's background color transparent (rgba(0,0,0,0)). fix issue, need define nav bar's background color white:

.navigation-bar .w3-top {   background: white; } 

please check codepen.


Comments

Popular posts from this blog

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -