how do you close the space at the top of a page?

J

James

trying to validate my webpage, i dont want any blank space at the top? I am
using a table layout.

<body topmargin="0">

is not valid but seems to work.

cheers
Poison
 
E

Edwin van der Vaart

James said:
trying to validate my webpage, i dont want any blank space at the top? I am
using a table layout.

<body topmargin="0">

is not valid but seems to work.

use in the style sheet margin-top: 0;
Or in your case <body style="margin-top: 0;">
 
D

DU

James said:
trying to validate my webpage, i dont want any blank space at the top? I am
using a table layout.

<body topmargin="0">

is not valid but seems to work.

cheers
Poison

topmargin, leftmargin, rightmargin, bottommargin will work in NS 4.x, NS
6.x, NS 7.x and Mozilla-based browsers but will NOT work in MSIE
browsers and other browsers.

On the other hand, if you use valid CSS code with, say,

body {margin: 8px;}

then all and each W3C web standards compliant browsers will honor this
declaration, in other words, this CSS declaration will be rendered by
many more browsers than if you use topmargin, leftmargin, rightmargin,
bottommargin.

There is a clear gain here for web authors to use, follow the W3C
recommendations.

Finally, I do not recommend to remove all margins on the body element:
browser manufacturers all give some kind of margins to the body element
because this helps reading a webpage. MSIE 5+ is the one giving the
biggest margin per default with
body {margin:15px 10px;}

DU
 
S

Steve Pugh

DU said:
topmargin, leftmargin, rightmargin, bottommargin will work in NS 4.x, NS
6.x, NS 7.x and Mozilla-based browsers but will NOT work in MSIE
browsers and other browsers.

That's not correct.
topmargin and leftmargin were introduced in IE3.
rightmargin and bottomargin were introduced in IE4.

marginwidth and marginheight (as attributes of body rather than frame)
were introduced in NN4. They are also supported by Opera (5+ IIRC).

I have no idea what Gecko-based browsers support and frankly I don't
care as these are outdated, invalid hacks, as you rightly point out.
On the other hand, if you use valid CSS code with, say,

body {margin: 8px;}

then all and each W3C web standards compliant browsers will honor this
declaration,

One additional point to consider is that whilst IE and Gecko both have
default margins on body, Opera has default padding. So any styles
should be written with that in mind (e.g. by setting margin:0;
padding: X;).

Steve
 
D

DU

Steve said:
That's not correct.
topmargin and leftmargin were introduced in IE3.
rightmargin and bottomargin were introduced in IE4.

marginwidth and marginheight (as attributes of body rather than frame)
were introduced in NN4. They are also supported by Opera (5+ IIRC).

I have no idea what Gecko-based browsers support and frankly I don't
care as these are outdated, invalid hacks, as you rightly point out.




One additional point to consider is that whilst IE and Gecko both have
default margins on body, Opera has default padding. So any styles
should be written with that in mind (e.g. by setting margin:0;
padding: X;).

Steve

Yes, you're absolutely right on everything. Thanks for correcting me on
this.

DU
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top