Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Wrapping text inside TD tag

Posted on 2004-09-07
11
Medium Priority
?
11,710 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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).

609 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