Making long strings of text break...

Reply

Join Date: Feb 2005
Posts: 355
Reputation: DanceInstructor is an unknown quantity at this point 
Solved Threads: 14
DanceInstructor's Avatar
DanceInstructor DanceInstructor is offline Offline
Posting Whiz

Making long strings of text break...

 
0
  #1
Apr 15th, 2005
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
Clear Mind Hosting and Web Design

If I've helped you please consider adding to my reputation.
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 764
Reputation: DaveSW is on a distinguished road 
Solved Threads: 17
DaveSW's Avatar
DaveSW DaveSW is offline Offline
Master Poster

Re: Making long strings of text break...

 
0
  #2
Apr 15th, 2005
What happens if you apply a width?
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 355
Reputation: DanceInstructor is an unknown quantity at this point 
Solved Threads: 14
DanceInstructor's Avatar
DanceInstructor DanceInstructor is offline Offline
Posting Whiz

Re: Making long strings of text break...

 
0
  #3
Apr 15th, 2005
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]
Clear Mind Hosting and Web Design

If I've helped you please consider adding to my reputation.
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 764
Reputation: DaveSW is on a distinguished road 
Solved Threads: 17
DaveSW's Avatar
DaveSW DaveSW is offline Offline
Master Poster

Re: Making long strings of text break...

 
0
  #4
Apr 15th, 2005
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.
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 355
Reputation: DanceInstructor is an unknown quantity at this point 
Solved Threads: 14
DanceInstructor's Avatar
DanceInstructor DanceInstructor is offline Offline
Posting Whiz

Re: Making long strings of text break...

 
0
  #5
Apr 15th, 2005
Thanks Dave. I guess I'll have to deal with it in php then
Clear Mind Hosting and Web Design

If I've helped you please consider adding to my reputation.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 5
Reputation: wkd is an unknown quantity at this point 
Solved Threads: 0
wkd wkd is offline Offline
Newbie Poster

break the line with css

 
0
  #6
28 Days Ago
you can use the css3 property [word-wrap: break-word;]
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 22
Reputation: Wrams is an unknown quantity at this point 
Solved Threads: 0
Wrams's Avatar
Wrams Wrams is offline Offline
Newbie Poster
 
0
  #7
23 Days Ago
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; 23 Days Ago at 5:31 pm.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 5
Reputation: wkd is an unknown quantity at this point 
Solved Threads: 0
wkd wkd is offline Offline
Newbie Poster
 
-1
  #8
23 Days Ago
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; 23 Days Ago at 6:39 pm.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 1
Reputation: randyman5775 is an unknown quantity at this point 
Solved Threads: 0
randyman5775 randyman5775 is offline Offline
Newbie Poster
 
0
  #9
23 Days Ago
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 22
Reputation: Wrams is an unknown quantity at this point 
Solved Threads: 0
Wrams's Avatar
Wrams Wrams is offline Offline
Newbie Poster
 
0
  #10
23 Days Ago
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.
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC