Placing divs of next two divs on top of each other

enter image description here

I want to place 3 divs, as shown in the photo div number 2 should stick to the bottom

here is what i did: http://jsfiddle.net/GLHur/1/

+5
source share
5 answers

It works:

    #div3{height:100px;width:100px;border: solid 1px #000;
display:inline-block;}
    #div1{height:30px;width:100px;border: solid 1px #000;}
#div2{height:20px;width:100px;border: solid 1px #000; position: absolute; bottom: 0}
#div1_2{display:inline-block;vertical-align:top; position: relative; height: 100px;}
+2
source

Try the following:

http://jsfiddle.net/GLHur/18/

<div class="con">
    <div id="div3"></div>
    <div id="div1_2">
        <div id="div1"></div>
        <div id="div2"></div>
    </div>
</div>

#div3{height:100px;width:100px;border: solid 1px #000; display:inline-block; background:red;}

#div1{height:30px;width:100px;border: solid 1px #000; position:absolute; top:0; background:blue;}
#div2{height:20px;width:100px;border: solid 1px #000; position:absolute; bottom:0; background:green;}

#div1_2{display:inline-block; vertical-align:top;}


.con { position:relative; }​
+4
source

:

<div id="content">
    <div id="div3"></div>
    <div id="div1"></div>
    <div id="div2"></div>
</div>

.

#content { position: relative; height: 100px; width: 220px; }

#div1{ position: absolute; top: 0; right: 0;   height:30px;  width:100px; background: blue; }
#div2{ position: absolute; bottom:0; right: 0; height:20px;  width:100px; background: green; }
#div3{ position: absolute; top: 0; left: 0;    height:100px; width:100px; background: red; }

jsFiddle

+1
<div style="position: relative;">
    <div style="height: 100%;"> </div>
    <div style="position: absolute; right: 0px;"> </div>
    <div style="position: absolute; right: 0px; bottom: 0px;"> </div>
</div>

div 'relative', div , . , - . , /- .

0

All Articles