944,081 Members | Top Members by Rank

Ad:
You are currently viewing page 1 of this multi-page discussion thread
Apr 15th, 2005
0

Making long strings of text break...

Expand Post »
If I have a long string of text in say a table cell, how can I make it break so it doesn't cause horizontal scrolling? Thanks
Similar Threads
Reputation Points: 17
Solved Threads: 14
Posting Whiz
DanceInstructor is offline Offline
355 posts
since Feb 2005
Apr 15th, 2005
0

Re: Making long strings of text break...

What happens if you apply a width?
Reputation Points: 54
Solved Threads: 20
Master Poster
DaveSW is offline Offline
765 posts
since Jul 2004
Apr 15th, 2005
0

Re: Making long strings of text break...

Nothing in Firefox. Works ok in IE. Let me post an ex:

[HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1"/>
<title>Variables</title>
<style>
.var_name
{
width: 250px;
overflow: hidden;
}

.var_value
{
width: 500px;
overflow: hidden;
}

table
{
width: 750px;
}
</style>
</head>
<body>
<table border="1" >
<tr>
<td class="var_name">stuff</td>
<td class="var_value">01234567891123456789212345678931234567894123456789512345678912345678971234567898123456789912345678901234567891123456789212345678931234567898</td>
</tr>
</table>[/HTML]
Reputation Points: 17
Solved Threads: 14
Posting Whiz
DanceInstructor is offline Offline
355 posts
since Feb 2005
Apr 15th, 2005
0

Re: Making long strings of text break...

I see.

There is a whitespace property, but browser support is frankly pathetic.
http://www.w3.org/TR/REC-CSS2/text.h...ite-space-prop
IE doesn't support it at all I don't think.

The only hacks I've seen to get around it involve a stray font called arial unicode and a space with 0 width... And apparently it doesn't work if you don't have the font, so it doesn't seem worth investigating.
Reputation Points: 54
Solved Threads: 20
Master Poster
DaveSW is offline Offline
765 posts
since Jul 2004
Apr 15th, 2005
0

Re: Making long strings of text break...

Thanks Dave. I guess I'll have to deal with it in php then
Reputation Points: 17
Solved Threads: 14
Posting Whiz
DanceInstructor is offline Offline
355 posts
since Feb 2005
Oct 29th, 2009
0

break the line with css

you can use the css3 property [word-wrap: break-word;]
wkd
Reputation Points: 10
Solved Threads: 0
Newbie Poster
wkd is offline Offline
5 posts
since Oct 2009
Nov 3rd, 2009
0
Re: Making long strings of text break...
Or simply add a <br /> which will force your text to move to the next line.
each time you come to the end of the text just insert a <br /> like this and it will automatically make it jump to the next line. Or another way is contain your text then that way it will be forced into a new line.

Not sure if I'm reading this thread right or not....Suppose I will soon be put right...

What about this?

HTML and CSS Syntax (Toggle Plain Text)
  1. [HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2.  
  3. <html>
  4. <head>
  5. <meta http-equiv="content-type" content="text/html;charset=iso-8859-1"/>
  6. <title>Variables</title>
  7. <style>
  8. .var_name
  9. {
  10. width: 250px;
  11. overflow: hidden;
  12. }
  13.  
  14. .var_value
  15. {
  16. width: 500px;
  17. overflow: hidden;
  18. }
  19.  
  20. table
  21. {
  22. width: 750px;
  23. }
  24. </style>
  25. </head>
  26. <body>
  27. <table border="1" >
  28. <tr>
  29. <td class="var_name">stuff</td>
  30. <td class="var_value">012345678911234567892123456789312345678941234567895123456789<br />
  31. 12345678971234567898123456789912345678901234567891123456789212345678931234567898</td>
  32. </tr>
  33. </table>[/HTML]
Last edited by Wrams; Nov 3rd, 2009 at 5:31 pm.
Reputation Points: 28
Solved Threads: 1
Newbie Poster
Wrams is offline Offline
22 posts
since Nov 2008
Nov 3rd, 2009
-2
Re: Making long strings of text break...
why would you do that when you can use css to automatically do it, how do you know where to put the break in all instances.. doesn't make sense. and what the hell are are you doing using tables still lol.
Last edited by wkd; Nov 3rd, 2009 at 6:39 pm.
wkd
Reputation Points: 10
Solved Threads: 0
Newbie Poster
wkd is offline Offline
5 posts
since Oct 2009
Nov 4th, 2009
0
Re: Making long strings of text break...
The Idea of this forum is to help each other. Rather than laugh at people for still using tables, you could share what you know about fixing it with CSS.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
randyman5775 is offline Offline
1 posts
since Jul 2009
Nov 4th, 2009
0
Re: Making long strings of text break...
Exactly my thoughts, he laughs but gives no help what so ever, I'm big on using <div> rather than <table>s but <table>s are needed for certain things. ie: TabularData or Scoring cards, things like that. I never use <table>s unless I really have to. If you can't help and just want to take the p*ss out of people trying to learn then whats the point in posting? The Guy asked for help and your laughing at him for having <table>s in his HTML.
Reputation Points: 28
Solved Threads: 1
Newbie Poster
Wrams is offline Offline
22 posts
since Nov 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: Hand cursor in IE6
Next Thread in HTML and CSS Forum Timeline: IFrame problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC