View Full Version : Vertical align to bottom of floating div

08-20-2010, 06:11 AM
Referencing the attached image, any ideas about how to achieve this layout using floats (rather than tables)?

The part that's giving me trouble is the bottom-left set of links, that should be aligned to the bottom of the container. Also, the width of the container is not fixed - it shouldn't have width specified at all, and expand to fit it's contents.

I'm not worried at all about fonts, borders, padding, colors, etc, just trying to achieve the attached macro concept using CSS, best-practices and w/out tables.


This layout is easily achieved using tables; the following markup (using tables) will render and behave as described - regardless of the size of the links, the size of the image, or the length of the description, but obviously I'd like to know how to do this with best practices of floating divs.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" >
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex, nofollow" />

<style type="text/css">
td {
vertical-align : top;
td.links {
text-align : right;
td.links.bottom {
vertical-align : bottom;
td.description {
width : 150px;




<td class="links">
<a href="#">Link</a>
<br />
<a href="#">Another Link</a>
<td rowspan="2">
<img src="http://static.howstuffworks.com/gif/code-breakers-1.jpg" />
<td class="description" rowspan="2">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>

<td class="bottom links">
<a href="#">Link</a>
<br />
<a href="#">Another Link</a>



TYIA for any suggestions.

08-20-2010, 08:32 AM

this may help you. :D

08-20-2010, 10:28 AM
thanks for the link - unfortunately, that doesn't address the issue of a floated element not expanding to the height of it's parent, which is necessary to use the bottom : 0px technique :/

08-20-2010, 12:01 PM
Haven't looked at the link, but with your html something like:

<div id="wrap">
<div id="extra">Links here</div>
<div id="left">Left</div>
<div id="middle">Middle</div>
<div id="right">Right</div>


then you can use absolute positioining to place the extra text always at the bottom left of #wrap. In this example all the columns are floated so we need to clear the float at the end of #wrap using overflow:auto.

#left{float:left;width:98px;border:1px solid red}
#middle{float:left;width:98px;border:1px solid blue;height:300px}
#right{float:left;width:98px;border:1px solid green}

08-20-2010, 12:39 PM
awesome - thanks a ton. i also appreciate the "just what's necessary" example - very helpful in understanding the concept.

08-20-2010, 12:52 PM
You're welcome. Just to add a clarification - the above assumes that the content in #left is always shorter than that in either #middle or #right.

It looks like that's the case - but if not, or as a precaution you could add some padding-bottom to #left to allow space for #extra .

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum