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

<topmargin="0" leftmargin="0">, got a bit of a problem

Status
Not open for further replies.

mettodog

Vendor
Jul 11, 2000
94
US
I have <topmargin=&quot;0&quot; leftmargin=&quot;0&quot;> in my page's <head> so that my top table will be right up in the corner. This works fine, but the bad thing is that all my text after the table is messed up as well. Can i add <topmargin=&quot;0&quot; leftmargin=&quot;0&quot;> to the table only, or is there a way to end this tag after the table?
 
You should use the style method for applying margins, I don't know even if the table tag accepts them. Define them inline - or class them:

...<table style=&quot;margin-top:0;margin-left:0&quot;> ...

Using styles you can apply these sorts of things to any object on your page ;)
b[sup]2[/sup] - benbiddington@surf4nix.com
 
that doesnt seem to want to work. Any other suggestions?
 
my code is exactly what bangers said. You try it.
 
Well, you know - sometimes it won't, if there is no space for it or something, you may have just to massage it into place a little. Just write a small test page, and you'll see it works. It does depend on what is around it.

You've also got padding at your disposal don't forget ;)
b[sup]2[/sup] - benbiddington@surf4nix.com
 
Why not put it in the BODY tag?
Code:
<BODY TOPMARGIN=&quot;0&quot; LEFTMARGIN=&quot;0&quot;>
That's how I used to do it before I discovered CSS. Works fine.

Or, you could use CSS like so:
Code:
BODY
{
  margin-top: 0;
  margin-left: 0;
}
Both work fine on my machine w/ IE4+
Kevin
slanek@ssd.fsi.com
 
That's for the body man! <table> does not support these - style only.
b[sup]2[/sup] - benbiddington@surf4nix.com
 
How about this bit of css:
table {position:absolute; top:0; left:0;}
works in both browsers. You can eve put negative values in top and left.
 
Maybe I'm missing something. If you put the margin attributes in the body tag, and the table is in the body, the table should be in the top left corner. Kevin
slanek@ssd.fsi.com
 
Absolute positioning is an annoyance these days when it comes to dynamic content, I suggest relative.

The man is asking if you can appply margins to the table only, and the way to do this is thru style. Obviously he doesn't want the whole body to have no margin - I thought his question was clear enough?
b[sup]2[/sup] - benbiddington@surf4nix.com
 
Just asking, brother. No need to tar and feather. ;) Kevin
slanek@ssd.fsi.com
 
yes, that is exaclty what i am asking. can anyone give me a good answer??
 
How about putting the margin attributes into the body tag like I was saying earlier, then putting the text (or anything else) that follows inside of <DIV> tags that have margin attributes that contradict the body's margins.

Here's what I did and I think it accomplishes what you're after. Table in the extreme upper left with text afterwards that has some left margin to it.

a style sheet like so:
Code:
BODY
{
	margin-top: 0px;
	margin-left:0px;
}

.myText
{
	margin-left: 50px;
}

Then in the HTML I have:
Code:
<TABLE...>
  <TR>
    <TD></TD>
  </TR>
</TABLE>

<DIV CLASS=&quot;myText>
  This would be the text that would follow the table.  It would have a left margin of 50 pixels whereas the table would have no left margin and no top margin.
</DIV>

Give it a shot. Kevin
slanek@ssd.fsi.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top