help with very annoying problem |
help with very annoying problem |
jjd228 |
Sep 28 2006, 12:22 PM
Post
#1
|
Group: Members Posts: 4 Joined: 28-September 06 Member No.: 258 |
i have a table with 1 row and 1 column. i need to set the width of this column to a fixed sixe that will not change. what is happening is that this cell is populated with information from a database. if the line is longer than the cell is wide, the whole thing stretches out and destroys that page. how can i make it so that the text wraps to the next line if its longer than the width of the cell?
|
jimlongo |
Sep 28 2006, 12:33 PM
Post
#2
|
This is My Life Group: Members Posts: 1,128 Joined: 24-August 06 From: t-dot Member No.: 16 |
Use CSS to fix the width of the table
http://www.w3.org/TR/REC-CSS2/tables.html#width-layout |
pandy |
Sep 28 2006, 12:51 PM
Post
#3
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
|
jjd228 |
Sep 28 2006, 02:24 PM
Post
#4
|
Group: Members Posts: 4 Joined: 28-September 06 Member No.: 258 |
ive tried usign 'table-layout' and it does not work, unless im applying it wrong. would you give me a small example? for instance: <table width="100"> <tr> <td width="50">this is the text i want to wrap</td> <td></td> </tr> </table> if that text is longer than 50px it will simply push the width of the TD out and make it expand. i dont want that. i want it to wrap to the next line when it hits the 50px mark. how would i apply the styles to this table structure? |
jimlongo |
Sep 28 2006, 02:36 PM
Post
#5
|
This is My Life Group: Members Posts: 1,128 Joined: 24-August 06 From: t-dot Member No.: 16 |
with an in-line style declaration . . .
HTML <html> <head> <style type="text/css"> <!-- table {table-layout: fixed;} --> </style> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>Untitled</title> </head> <body> <table border="2" width="80%"> <tr> <td width="50"> if the text in this column is wider than 50 pixels it will rap unless like pandy says there is a "unbroken" string - in that case it will not wrap (see column 3) </td> <td width="50"> test </td> <td width="50"> testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest </td> </tr> </table> </body> </html> This post has been edited by jimlongo: Sep 28 2006, 02:38 PM |
pandy |
Sep 28 2006, 02:38 PM
Post
#6
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
The text wraps fine in the example you posted, so what about you show us the real deal where it doesn't wrap?
'table-layout: fixed' doesn't make anything wrap that wouldn't otherwise. On the contrary, if you don't know if there can be unbreakable strings or pictures wider than the allowed width, the construct will break. Browsers are wonky with this layout mode, too. |
jjd228 |
Sep 28 2006, 03:11 PM
Post
#7
|
Group: Members Posts: 4 Joined: 28-September 06 Member No.: 258 |
so in other words if there is no "enter" pressed, it wont wrap?
the "word-wrap: break-word;" tag WILL wrap even when there is no linebreak in the text, but its only supported in IE!!!! so what do i do? i cant make people hit enter when theyre filling in a text box |
Christian J |
Sep 28 2006, 03:18 PM
Post
#8
|
. Group: WDG Moderators Posts: 9,653 Joined: 10-August 06 Member No.: 7 |
i cant make people hit enter when theyre filling in a text box You can let a server-side script cut up strings after a certain length, e.g. with PHP: http://se2.php.net/manual/en/function.wordwrap.php |
jjd228 |
Sep 28 2006, 03:24 PM
Post
#9
|
Group: Members Posts: 4 Joined: 28-September 06 Member No.: 258 |
wouldnt happen to have a vbscript example would ya? if not im gonna have to convert that mess
|
Lo-Fi Version | Time is now: 19th April 2024 - 04:49 PM |