stormwild stormwild - 2 months ago 14
CSS Question

How can I position elements within a table cell (td) such that one element is left aligned and the other right aligned?

Given the html code below:

<td>Some text <a href="">Some link</a> <button>Some Button</button></td>

I would like to achieve something like this:

Image of Table

Would I need to add additional mark-up such as wrapping divs to float one to the left and the other to the right? I would also need elements within the td to be vertically aligned.

What would be the best way to achieve this with minimal additional mark-up.

I have sample code here:

A related problem is how to keep alignment of the text consistent among table cells when one cell contains a floated element?

enter image description here

Dai Dai

CSS: td button { float: right; }