css - Z-index in front of an element in a fixed position -


i not find solution problem turn :).

here context: have 2 brothers elements, 1 absolute position , other in fixed position. basic fixed element @ top. consider in code below:

* {    box-sizing: border-box;  }  html, body{    margin: 0;    padding: 0;    height: 100%;    width: 100%;  }  #element1 {    background: red;    height: 100%;    width: 100%;    position: absolute;  }  #element2 {    background: green;    margin: 0 auto;    height: 200px;    position: absolute;    width: 600px;  }  #element3 {    background: blue;    height: 200px;    position: fixed;    bottom: 0;    width: 100%;  }    #element1,  #element3 {    z-index: 1;  }	  #element2 {    z-index: 10;  }
<div id="element1">    <div>       <div id="element2"></div>    </div>  </div>  <div id="element3">    </div>

http://jsfiddle.net/p7c9q/1162/

that green color area modal. objective make element green on element in fixed position.

how can unlock myself knowing element 1 , element 2 must remain in absolute position?

thank in advance, cordially.

element3 on element1 , children if child of element1 has higher z-index because related parent element1 has lower z-index element3

there 2 solutions case:

  1. put element2 , element3 children element1

* {    box-sizing: border-box;  }  html, body{    margin: 0;    padding: 0;    height: 100%;    width: 100%;  }  #element1 {    background: red;    height: 100%;    width: 100%;    position: absolute;  }  #element2 {    background: green;    margin: 0 auto;    height: 200px;    position: absolute;    width: 600px;  }  #element3 {    background: blue;    height: 200px;    position: fixed;    bottom: 0;    width: 100%;  }    #element1,  #element3 {    z-index: 1;  }	  #element2 {    z-index: 10;  }
<div id="element1">    <div>       <div id="element2"></div>    </div>    <div id="element3">      </div>  </div>

  1. make element2 outside element1 in same level element3

* {    box-sizing: border-box;  }  html, body{    margin: 0;    padding: 0;    height: 100%;    width: 100%;  }  #element1 {    background: red;    height: 100%;    width: 100%;    position: absolute;  }  #element2 {    background: green;    top:25%;    left:15%;    margin: 0 auto;    height: 200px;    position: fixed;    width: 600px;  }  #element3 {    background: blue;    height: 200px;    position: fixed;    bottom: 0;    width: 100%;  }
<div id="element1"></div>  <div id="element2"></div>  <div id="element3"></div>


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -