Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Setting adjustable <td> how do I do it?

Posted on 2004-11-21
5
Medium Priority
?
191 Views
Last Modified: 2010-04-09
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?
0
Comment
Question by:Jennie2004
  • 3
  • 2
5 Comments
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 12639572
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
 

Author Comment

by:Jennie2004
ID: 12639993
<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
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 500 total points
ID: 12640096
<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
 

Author Comment

by:Jennie2004
ID: 12648628
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
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 12649644
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question