Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mis-behaving table

Status
Not open for further replies.

skiflyer

Programmer
Sep 24, 2002
2,213
US
I have a table which I want to stop at the edge of the window so I won't have to scroll right and left... I'm setting the width tag at 75% to accomplish this... this is my line cut from the source of the page after it loads.

<table border = 1 width=75%>

Yet, the table goes way off to the right, and I need to scroll. What makes a table misbehave like this, and is there anything I can do to fix it?

-Rob
 
do you have conflicting tables that are causing more then a total of 100% of the page
more or less
<table width=&quot;100%&quot;>
now add the tables to be the percentage of the main tableequaling no more then 100% but equaling 100%
</table>

this will prevent or attempt to prevent two tables or more next to each other that may result in say 150% of the page. Although you can still ruin it in a sense.

---------------------------------------
{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }
---------------------------------------
for the best results to your questions: FAQ333-2924

 
this is in fact the only table on the page... is it possible that if you stuff too much data in a table it won't abide by the width rules?

-Rob
 
not unless you are specifying a width for the cells
<td width=2000> for example will still fly off the screen with a table set to 75% of the screen ---------------------------------------
{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }
---------------------------------------
for the best results to your questions: FAQ333-2924

 
to give you a little more of a reference to what I meant there do this
<table width=&quot;75%&quot;>
<tr>
<td align=&quot;right&quot;><img src=&quot;blank.gif&quot; width=&quot;2000&quot;></td>
</tr>
</table> ---------------------------------------
{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }
---------------------------------------
for the best results to your questions: FAQ333-2924

 
Yeah, I understand that... have used tables successfully and such for ages... and this one should be working from all I can tell... my only guess is that since I'm not specifying a width for the cells it's assigning a minimum width of some sort. (If I limit the data in the cells, I can get 70% or so to work, and anything lower doesn't reduce it farther... not what I was hoping for, but it works.

If you're curious enough to replicate it, make a table with 14 columns, and make each one about 15 characters... see if you have better luck than I.

-Rob
 
of course taht's not going to work. you have 210 bytes give a few more for padding etc. spaning accross the page.
you need to specify a width for the cells at that point
say 7 px ---------------------------------------
{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }
---------------------------------------
for the best results to your questions: FAQ333-2924

 
Well I never told it not to wrap the words or some such... And in another place, I have this same table inside a table which is restricted in width, and it stays in those boundaries... out on it's own, it sucks... in another table which just tries to restrict boundaries and have this table as its only elemental, no go.

Perhaps I'll think about limiting each cell... but I'm hoping to avoid that, this is going to be one of those accessed once a month kind of pages anyway, so I'm thinking I'd rather save the readability and make them scroll.

Thanks for trying to help.

-Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top