jsertx
jsertx

Reputation: 636

Align divs to the bottom

I have to appends divs into another div with position absolute(can't be relative) to the bottom, the code looks like

<div style="position:aboslute; top:100px; left:200px; height:500px">
    <div style="height:20px">Example 1</div>
    <div style="height:2px">Example 2</div>
</div>

Solutions?

Upvotes: 0

Views: 81

Answers (1)

Praveen Kumar Purushothaman
Praveen Kumar Purushothaman

Reputation: 167182

Give relative position to parent and absolute position to children.

<div style="position:aboslute; top:100px; left:200px; height:500px">
    <div style="height:20px; position: absolute; bottom: 0;">Example 1</div>
    <div style="height:2px; position: absolute; bottom: 0;">Example 2</div>
</div>

Preview:

Align divs to the bottom

Check out the fiddle here: http://jsfiddle.net/vLn32/

Upvotes: 1

Related Questions