?
Solved

Wrapping text inside TD tag

Posted on 2004-09-07
11
Medium Priority
?
11,709 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
WordPress Tutorial 3: Plugins, Themes, and Widgets

The three most common changes you will make to your website involve the look (themes), the functionality (plugins), and modular elements (widgets).

In this article we will briefly define each again, and give you directions on how to install them.

 
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 160 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 80 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

801 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