HabibS
HabibS

Reputation: 382

Make a div position bottom of another div

I've a div inside another div that wants to show at the bottom. But it wont. Look at the code:

...
<td valign="top" style="height: 900px;">
    <center>
        <div class="sidebar">
              <div id="block_sub">Hello</div>
        </div>
        </center>
</td>
...

<styles>
.sidebar{
position: relative;
}
#block_sub{
position: absolute;
bottom: 0;
}
</styles>

Upvotes: 0

Views: 70

Answers (1)

Mark Simpson
Mark Simpson

Reputation: 2374

Works fine for me:

http://jsfiddle.net/2nssD/

You made two mistakes through:

You used #sidebar instead of .sidebar, and you didn't give your outer div a height.

Use this:

.sidebar{
    position: relative;
    background: red;
}
#block_sub{
    position: absolute;
    bottom: 0;
    background: blue;
}

Upvotes: 2

Related Questions