Setting adjustable <td> how do I do it?

I want one of my <td> in my table to never have a broken road.

I don't know the exact width so setting a fixed px amount is not good.

Is there a way to write it so that the td writes in the exact space it needs no more and no less?
Jennie2004Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

COBOLdinosaurCommented:
If you do not give it a width and height, it will size to content.  However it can be affected by the size of othere cells in the table, so there is never a guarantee with cells.  If you are using it to manage layout then you are making a common mistake.  Tables were never meant to be used for layout.  If you give more detail or post your code perhaps we can give you a better solution.

Cd&
0
Jennie2004Author Commented:
<table>
<tr>
      <th>Article
      </th>
      <th>
      Cost Description
      </th>
      <th>
      Comments
            </th>
</tr>

<tr>
  <td>Name1</td>
  <td>Very High</td>
  <td>The cost is high because of the .............</td>
</tr>

</table>

Sometimes the cell 'Cost Description' becomes two rows and sometimes the 'Article' becomes two rows when the 'Comments' are long.
I would like 'Article' to never become two rows and the cell 'Cost description should also be as small as possible without becoming two rows. Suggestions?
0
COBOLdinosaurCommented:
<td>Name1</td>
  <td style="white-space:nowrap">Very High</td>
  <td style="white-space:nowrap">The cost is high because of the .............</td>


Cd&
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jennie2004Author Commented:
Nothing happens when I apply it directly in the .php page or in the STYLESHEET. I found a site css4you.de  
http://www.css4you.de/example/white-space.html
They say the same thing. I just don't get it to work. So the answer is correct I just don't get it :(

td.row {
white-space:nowrap;
}

th {
 white-space:nowrap;
}

<td style="white-space:nowrap">

All the same result. Nothing :(

Is IE 5 enough to use this white-space?
0
COBOLdinosaurCommented:
IE 5.5 and higher.  There should not be many user still on 5.0 I don't think.

If you still have to support version earlier than 5.5 you can use the old HTML property:

<td nowrap>

That works very similar, but it is depreciated and in the latest standards (xhtml1.1) it has been dropped, so you could put both the style and the older property in the tag so that it support s the old browsers but does not break for future changes:

<td nowrap style="white-space:nowrap">

Cd&



0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.