How to set seperate heights for <td> ? I have table with one rows and 2 cells. In one of them there is more data, so it drags the other cell longer than it should be and that's ugly. I need something that automatically adjusts the cell height according to how much data it consists. How can I achieve this effect ?

5 Years
Discussion Span
Last Post by Martin C++

If you look into using CSS it may help, you can use a fairly simple code on each part of the table.
You can simply assign a class to each row / column to control what the style is a width.

The css for this is as follows, assign the class then place this in the style sheet.

width: auto;
height: auto;

this should solve your problem, just make sure you do the class on each part of the table, such as

    <td class="tablesize">&nbsp;</td>
    <td class="tablesize">&nbsp;</td>

if you dont know how to attach a stylesheet, there are numerous tutorials on this.


It did not fix my problem.

Check image in attachment, maybe it helps to understand what I need.

This is what I have. I need the second box to be with exact height of how much data it has inside.


Please post code, including CSS, its hard to figure it out without this. Should be able to sort this quicker with the code :)


You can create a parent div that contains 2 child divs. The first child div should be floated left, whilst the other floated right. But, you will have to do some fiddling with CSS to make the children divs remain in the parent.


I had them in divs before but I decided to go with tables cause it seemed to be more cleaner, but I guess I will switch back to divs cause I cant resize cells. Thanks for help guys!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.