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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why isn't a table with 100% width 100% wide?

Status
Not open for further replies.
Jun 19, 2001
86
US
I have an html document that has the following tag setup for the body. The document also has a table that has a width of 100%. Occasionally when I load the document in IE I have about a quarter inch gap between the right side of the table and the scroll bar. If I refresh the page it goes away. What's the secret to getting a table to load the full width of the screen without refreshing?

Nathan

<body topmargin='0' leftmargin='0' marginheight='0' marginwidth='0'>
 
Make sure your table has a cellpadding of 0 and cellspacing of 0

eg:
<table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
 
It does. Have you not ever encountered this problem?

Nathan
 
Yes, its the &quot;reloading&quot; bug, but when you have content extending pass your &quot;viewable&quot; area (hence scrolling down), it appears a-okay.


Add rightmargin=&quot;0&quot; in your body tag.
 
Worked like a charm! I wasn't even aware that rightmargin='0' was an attribute. Thanks for your help.

Nathan
 
Actually it isn't. Dont know why it isn't, but it isn't. W3C doesn't even recognize the tag. As much as I hate going against W3C, I found it quite odd that they would not include rightmargin in their tags. Oh well.
 
Why not just do this (it's in the standard):

<style>
body{
margin:0;
}
</style>

Rick
 
It has never worked for me. You could try, but it still does the &quot;reload&quot; bug.
 
As far as I understand it, rightmargin (along with left~, top~, and bottom~) are all proprietary tags added by Microsoft. The correct ones are marginwidth and marginheight. I usually set them all to just be careful.

Styles are nice, but you have to remember that some browsers still aren't up to par on that - yeah, I know it sucks. ________________________________________
Michael C Flanakin
Indigo Web Systems
michael.flanakin@indigows.com
 
The correct syntax for setting the right margin in CSS is:

margin-right: 0;

not rightmargin

Or as RISTMO suggested:
margin: 0;

That is shorthand for:
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
margin-left: 0;

Or you could code
margin: 0 0 0 0; Joe Bananas' guide to Perth, Scotland
Bananas' tribute to Fawlty Towers!
 
right~, left~, top~, and bottommargin are all tag properties, not CSS properties.

<body rightmargin=&quot;0&quot; leftmargin=&quot;0&quot; topmargin=&quot;0&quot; bottommargin=&quot;0&quot;> ________________________________________
Michael C Flanakin
Indigo Web Systems
michael.flanakin@indigows.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top