I want to place the 3 divs as shown in the photo div number 2 must stick to the bottom
here is what i have done: http://jsfiddle.net/GLHur/1/
By using a div with style z-index:1; and position: absolute; you can overlay your div on any other div . z-index determines the order in which divs 'stack'. A div with a higher z-index will appear in front of a div with a lower z-index . Note that this property only works with positioned elements.
With CSS properties, you can easily put two <div> next to each other in HTML. Use the CSS property float to achieve this. With that, add height:100px and set margin.
you can use flex property for, Display:flex apply flex layout to the flex items or children of the container only. So, the container itself stays a block level element and thus takes up the entire width of the screen. ...
Using CSS position property: The position: absolute; property is used to position any element at the absolute position and this property can be used to stack elements on top of each other. Using this, any element can be positioned anywhere regardless of the position of other elements.
Try this:
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; }
This 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;}
Something like this?
http://jsfiddle.net/GLHur/6/
Or does the height change once you add content?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With