Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML: Anchor block element inside bottom of parent block?

Tags:

Is there a cross browser method of attaching some content in a <div> to the bottom? One difficulty is that the <div> may have an arbitrary height applied, but I want certain content to be stuck to the bottom of it at all times.

This would have been accomplished in the bad old days like this:

<table style="height: foo;">     <tr><td valign="top">content</td></tr>     <tr><td valign="bottom">stuck to the bottom</td></tr> </table> 

Can I do this without resorting to this technique?

like image 746
recursive Avatar asked Sep 22 '09 21:09

recursive


1 Answers

Sure, it's pretty easy. Just set the parent div with position:relative. Then, the inner item you want to stick to the bottom, just use position:absolute to stick it to the bottom of the item.

<div id="parent">     <div id="child">     </div> </div> 

.

#parent {   position:relative; } #child {   position:absolute;   bottom:0; } 
like image 117
TJ L Avatar answered Oct 13 '22 07:10

TJ L