Solved

Wrapping text inside TD tag

Posted on 2004-09-07
11
11,702 Views
Last Modified: 2010-05-18
Hi,

   I have a table where I have sepcified width for all columns. When I add a text of more than 30 chars, the column instead of wrapping the text, it expands. It behaves as though I have given nowrap for the TD. Is there any way I can make the text wrap once it is exceeding the specified width given to the column.

Thank you
0
Comment
Question by:gops1
  • 3
  • 2
  • 2
  • +4
11 Comments
 
LVL 8

Expert Comment

by:RozanaZ
ID: 12003758
Why don't you remove nowrap from TD?
0
 
LVL 17

Author Comment

by:gops1
ID: 12003797
Rozana,

I have not used nowrap. I meant when i put some text without any space the TD BEHAVES like a TD with nowrap.

Gops
0
 
LVL 2

Expert Comment

by:ecupd
ID: 12003980
Hi Gops,

paste your code, it sounds like there is no width value given to the <table> tag.
with table widths set a TD should eventually wrap always

Is there any content in any of the TD's in that column that hold it at a particular min width at the moment?

dayton
0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
LVL 4

Expert Comment

by:samscudder
ID: 12005037
If it's just one word it will expand the column. In IE, there is the "word-wrap" style, but I´m not sure about other browsers:

<table border=1>
<tr>
<td width=50 style="word-wrap: break-word">OneLongWordWhichWillBeBroken</td>
</tr>
</table>

Hope this helps

S
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 12005231
You may need to add this to Sam's last post:

<table ........  style="table-layout:fixed;">

Thanks,
Sean
0
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 40 total points
ID: 12008979
Using non-standard thing like word-wrap is a bad idea.  All you do is create a fundemental design defect in non-IE browsers; definitely not a good idea at the rate IE is losing market share.

table-layout:fixed will resolve the expanding cell problem, but will create a new one.  IE by default will hide the overflow(truncate it) but Mozilla will render it outside the box. so overflow needs to be use to control the dispositon of the excess:

<td width=50 style="overflow:hidden;clip:auto">OneLongWordWhichWillBeBroken</td>
or
<td width=50 style="overflow:auto;clip:auto">OneLongWordWhichWillBeBroken</td>

are standards compliant, and will continue to work after IE is forced to follow the standards, and get rid of the proprietary bloat to stay competitive.

Cd&
0
 
LVL 5

Assisted Solution

by:KarcOrigin
KarcOrigin earned 20 total points
ID: 12012413
Hmmm...doesn't work

<Table width="100%">
<TR>
  <TD width="25%" style="overflow:auto;clip:auto">TextboxTextboxTextboxTextboxTextboxTextboxTextboxTextboxTextboxTextbox</TD>
  <TD width="75%"><INPUT id="txtBox" name="txtBox" value="Test value"></TD>
</TR>
</Table>

But gops1 COBOLdinosaur is write. I also don't think it is a good idea to be specific to only one browser. If you are getting the continous string then better break it with a single spaces.

Cheers!

0
 
LVL 17

Author Comment

by:gops1
ID: 12013191
Thanks a lot COBOLdinosaur and Karc.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 12016388
Glad we could help.  Thanks for the A. :^)

Cd&
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 12016444
... and thank you Cd& for pointing out the proprietary MS code - I keep forgetting what's part of the official spec and what isn't.
That cave wall must come in pretty handy :-)
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 12018992
I keep running up against the IE only stuff all the time trying to migrate apps to support Mozilla.  It hard to believe some of the stuff we used to do because we were in an IE environment.  Fortunately .net is pretty much a dead issue so I don't have to fight that off... at least in the technology division.  Corporate is another story.  They think the world revolves around activex. :^(

Cd&
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to use embargo Date/time in php 29 39
CSS Logo Problem. 2 21
ASP.net Fit 3 divs on screen side by side 3 28
div to fit another div 8 23
Introduction The Google Maps API offers various ways to draw dynamic and static maps.  Using a combination of PHP and JavaScript, you can draw active JavaScript maps that allow pan-and-zoom in the client browser window.  You can also draw "static" …
Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

803 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