Problem with Table Size

admin

Administrator
Staff member
Hello group <br />
I have problem with Table size, the table generates with asp code but what is important is the size of table changes if the text inside <td> tag is big.<br />
this is what i am talking about in code: <br />
<center><table width = 180><br />
<tr><br />
<td width = 180> ""here texts come from database with diferrent sizes"" </td><br />
</tr><br />
</table></center><br />
<br />
the size of table changes with long texts, i want to cut the text into new line exactly like this forum and save table size 180p. <br />
what is the problem? <br />
thanks in advance.<!--content-->the example you posted worx just fine ( im on xp pro with ie6 )...<br />
<br />
I have come accross the problem youhave a few times as well and here's what I have found:<br />
<br />
==============<br />
before anything else, try letting your server create the table that appears mis-width'd and then view the source and copy the table code ( withOUT any java/vb scripts and withOUT any styling and withOUT any doctypes ) to a blank file with ONLY the table code...<br />
<br />
then open it in your browser and see if it works, if it does then its either styling, the doctype settings you have, or any java/vb scripts<br />
==============<br />
<br />
<br />
the thing is that with tables, they will expand any td's automatically in order to encumpass the entire text, graphics, and whatever else is in the td's...<br />
<br />
if you have any & N B S P ;'s in there then changing them to actual spaces would help as would the font size of the text, and the size of large words...<br />
<br />
if the font size is so big that a word like "character" would be wider than 180px's then the browser would expand the td to compendate... likewise on the words or code, say for example the word "SuperCaliFragilisticExpiAliDocious" from the mary poppins musical... that would is soooo long that even in a regular font size, it may be too long to fit in 180px's<br />
<br />
I would suggest on words that would be too long to add a separator or two, then the browser would separate the word automatically for you, such as:<br />
<br />
change this:<br />
<br />
<center><table width = 180><br />
<tr><br />
<td width = 180>SuperCaliFragilisticExpiAliDocious</td><br />
</tr><br />
</table></center><br />
<br />
<br />
into this:<br />
<br />
<center><table width = 180><br />
<tr><br />
<td width = 180>SuperCali-Fragilistic-ExpiAli-Docious</td><br />
</tr><br />
</table></center><br />
<br />
<br />
<br />
if you don't face these problems, please let your server create one of these mis-width'd tables and paste it then we could probably figure out what else may be occuring...<br />
<br />
in addition to that, all i can suggest if everything still looks all good is to check any doctypes and also any styling you may have...<!--content-->thank you ucm<br />
this cleared many things for me. now what i need is a way to wrap the long word into 2 lines for example: <br />
ThisWordIsVeryBigAndCantFitIn180Pixel <br />
and the new line size fit into my table size. in your example the second code worked fine but how can i do this with a text from database?Is that to add dash between words and how recognize words or how detect the word's size?<br />
i know this sounds stupid to ask here but if you know how to avoid abuse of sending these sorts of text to forum,comment, whatever please give me some tips.<br />
Thanks<!--content-->it's not supid at all, we've all been there when it should makes sence but we're just miss'n a liiiittle something or other...<br />
<br />
i would recommend using your asp to search the sizes of the words and if they are say too big then to insert a space in there at the specific locations in the string and Then print the word and goto the next one...<br />
<br />
--edit--<br />
<br />
O_O &nbsp;&nbsp;&nbsp;I CAN"T BELIEVE i didn't think of this before...<br />
<br />
an even better way would be to let an anchor do the work for you ;)<br />
<br />
something like:<br />
<br />
<a style="width:180px;border-style:none;background-color:transparent;border-width:0px;word-break:break-all;word-wrap:break-word;">ThisWordIsVeryBigAndCantFitIn180Pixel</a><br />
<br />
<br />
<br />
although i think this only works in ie5.x and later, if you want other browsers to do it then it will become a bit more complicated as you would need to have asp search each word ( before printing it to the user ) for it's length and break it up if it's too big... if you go the asp word search route, i would suggest creating a function with 2x parameters, the text string to search for too big of words and the max word length that no word can be bigger than...<br />
<br />
i could probably hook up a javascript example of this and then you could take that to your asp resources to convert the idea into asp code if you wish... ( might take a little while )<br />
<br />
<br />
<br />
--/edit--<!--content-->man! that's exactly what i want, thanks so much.<br />
i have no clue where did you find this or how did you figur it out but however you did, it was great.<br />
Thanks ;)<br />
.<!--content-->im glad to have help ya out...<br />
<br />
i found it by looking for a css poroperty to do something very simular to what you were going for...<br />
<br />
try your favorite search engine like google or yahoo for something like:( quotes included to narrow the search even more )<br />
"css word-wrap"<br />
<br />
btw, everything i've seen so far says that this only works on ie 5.x and up<br />
<br />
some time ago, scout posted a link to where you can get a good list of css properties, if he reads this : please post that link again, i couldn't find it searching for it on the forum search thingy, my bad<!--content-->
 
Back
Top