html - What to position a div relative to a div relative to a div -


i produce following template div elements

the idea div element have specific position relative div element containing positioned relatively div element containing it.

i relation between 2 div elements making 1 have position:absolute , container having position:relative

but how make relative big container.

here image explaining i'm describing on top , i'm trying achieve.

enter image description here

i managed code on jsfiddle. here go:

jsfiddle demo

you can enlarge output window's width , set width etc according project.

body {    margin: 0;    padding: 0;  }    * {    webkit-box-sizing: border-box;    -moz-box-sizing: border-box;    box-sizing: border-box;  }    .wrapper {    margin: 50px auto 0;    max-width: 600px;  }    .outer_div {    border: 3px solid green;    padding: 10px;  }    .inner_div {    padding: 10px;  }    .inner_div .box:nth-child(3n) {    margin: 0;  }    .inner_div .box {    border: 3px solid #03a9f4;    width: 172px;    float: left;    height: 200px;    margin: 0 auto 12px;    margin-right: 10px;  }    .inner_div {    padding: 10px;    border: 2px solid red;    display: block;    width: 98%;    margin: 10px auto 0;    overflow: auto;  }    .inner_div:last-child {    padding-bottom: 0;  }
<div class="wrapper">    <div class="outer_div">      <div class="inner_div">        <div class="box">          </div>        <div class="box">          </div>        <div class="box">          </div>        <div class="box1">          </div>        <div class="box1">          </div>        <div class="box1">          </div>          <div class="box">          </div>        <div class="box">          </div>        <div class="box">          </div>        <div class="box1">          </div>        <div class="box1">          </div>        <div class="box1">          </div>      </div>        <div class="inner_div">        <div class="box">          </div>        <div class="box">          </div>        <div class="box">          </div>        <div class="box1">          </div>        <div class="box1">          </div>        <div class="box1">          </div>        <div class="box">          </div>        <div class="box">          </div>        <div class="box">          </div>        <div class="box1">          </div>        <div class="box1">          </div>        <div class="box1">          </div>      </div>      </div>    </div>


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -