Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Two divs aligned at the bottom

Status
Not open for further replies.

minli98

IS-IT--Management
Aug 30, 2005
178
US
Hi,

I have this following problem: I have two divs that are side-by-side. The widths are pre-determined, but the heights are dynamic. I would like to make the two divs aligned at the bottom. Something like this:

Code:
********
*      *
* Div 1*
*      * ******
*      * *Div2*
******** ******

I was thinking that the easiest way would be to use table, but is there a css solution for this?

Many thanks,
Min
 
Code:
div#div1 {
    position: absolute;
    width: 200px;
    bottom: 0;
    left: 0;
}

div#div2 {
    position: absolute;
    width: 100px;
    bottom: 0;
    left: 200px;
}

This should give you two divs along the bottom of your browser window. The second one should be adjacent to the first one.

Is this what you're looking for?

--
-- Ghodmode
 
Almost, but not quite. I don't want the two divs to be aligned to the bottom of the browser, but to the bottom of a containing div which may be placed anywhere. Should have made this clearer with my earlier post.

Min
 
Ok, it works now with the code below (1 modification from Ghodmode's version). Thanks you two.

Code:
div#container{
    position:relative;
    width:300px;
}

div#div1 {
    position: relative;
    width: 200px;
    bottom: 0;
    left: 0;
}

div#div2 {
    position: absolute;
    width: 100px;
    bottom: 0;
    left: 200px;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top