| | |
Making long strings of text break...
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
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
What happens if you apply a width?
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]
[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]
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.
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.
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?
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)
[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">012345678911234567892123456789312345678941234567895123456789<br /> 12345678971234567898123456789912345678901234567891123456789212345678931234567898</td> </tr> </table>[/HTML]
Last edited by Wrams; 23 Days Ago at 5:31 pm.
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.
![]() |
Similar Threads
- Writing text from textbox to file... (C++)
- Compile errors [help] [ log ] (C++)
- Counting the amount of letters in a phrase! (C++)
- JSP and Oracle (JSP)
Other Threads in the HTML and CSS Forum
- Previous Thread: iframe background color
- Next Thread: Starting to learn website design
| Thread Tools | Search this Thread |
appointments asp background backgroundcolor beta browser bug calendar cart cgi code codeinjection corporateidentity css design development displayimageinsteadofflash dreamweaver emailmarketing epilepsy explorer firefox flash form format google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization pnginie6 positioning problem scroll seo shopping studio swf swf. textcolor timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7





