html - Z-Index is not working -


https://codepen.io/anon/pen/vebqyy?editors=1100

i have div class filter. div make background image lighter. trying make div class inner go on top of filter. put z index: 9999 on inner div not going top

html, body {    height: 100%;  }    .outer {    display: table;    height: 100%;    width: 100%;     background: url('https://static.pexels.com/photos/56875/tree-dawn-nature-bucovina-56875.jpeg');          background-size: cover;        }    .middle {    display: table-cell;    width: 100%;    vertical-align: middle;    text-align: center; // center in div  }               /* dim background */  .filter {    position: absolute;    width: 100%;    height: 100%;    top: 0;    background-color: black;    opacity: 0.5;      }    /* not working. z index not bringing top */  .inner {    z-index: 9999;    }    h1 {    color: white;  }
<section class="outer">    <div class="middle">      <div class="filter"></div>      <div class="inner">        <h1>need</h1>        <h1>this go on top zindex 9999 not working</h1>      </div>    </div>  </section>

you need make .inner div position relative

.inner {   z-index: 9999;     position: relative; } 

z-index works on positioned elements (position:absolute, position:relative, or position:fixed).

https://www.w3schools.com/cssref/pr_pos_z-index.asp


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -