To position child divs within a container, set the container div to position:relative
and the child divs to position:absolute
.
This allows you to easily align the child divs by using properties like bottom:0px
for vertical alignment and left/right styling for horizontal positioning.
I have created a working example on jsFiddle: http://jsfiddle.net/Damien_at_SF/KM7sQ/5/. Here is the code:
HTML:
<div id="container">
<div id="left">left</div>
<div id="center">center</div>
<div id="right">right</div>
</div>
CSS:
#container {
position:relative;
height:400px;
width:100%;
border:thick solid black;
}
#container div {
background:grey;
width:200px;
}
#left {
position:absolute;
left:0px;
bottom:0px;
}
#center {
position:absolute;
left:50%;
margin-left:-100px;
bottom:0px;
}
#right {
position:absolute;
right:0px;
bottom:0px;
}
Note: For the "center" div, the margin-left should be half the width of the div :)
I hope this explanation helps! Feel free to reach out with any questions.