954,604 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Seperate heights for <td>

How to set seperate heights for ? 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 ?

Martin C++
Light Poster
43 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0
 

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.

.tablesize
{
width: auto;
height: auto;
}


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

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


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

Awilson089
Newbie Poster
15 posts since Apr 2011
Reputation Points: 10
Solved Threads: 1
 

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.

Attachments table.jpg 162.8KB
Martin C++
Light Poster
43 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0
 

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

Awilson089
Newbie Poster
15 posts since Apr 2011
Reputation Points: 10
Solved Threads: 1
 

Why are you using a table?
Look at this:
http://jsfiddle.net/wP9pq/6/

t3o
Newbie Poster
5 posts since Feb 2012
Reputation Points: 10
Solved Threads: 0
 

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.

wilch
Junior Poster in Training
84 posts since Aug 2007
Reputation Points: 25
Solved Threads: 17
 

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!

Martin C++
Light Poster
43 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You