By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,738 Members | 1,114 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,738 IT Pros & Developers. It's quick & easy.

body margins....

P: n/a
when I test my stuff with the validator in HomeSite it tells me the body
tag no longer reads margin attributes.. does this mean now margins are
to be specified only in CSS?

I work for an internet co., they support IE 5+ and the old pre-6
Netscape..

if you don't put this tag in html docs, what version of HTML does it
default to?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
(just wondering... because the HomeSite debugger always says that
such-and-such is longer valid in "currently active versions" (of HTML, I
suppose, although it doesn't say...))
thank you..

Frances Del Rio
NYC

Jul 20 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
Frances Del Rio wrote:
when I test my stuff with the validator in HomeSite it tells me the body
tag no longer reads margin attributes.. does this mean now margins are
to be specified only in CSS?
That's preferred, but it depends entirely on which (X)HTML version
you're coding to.
I work for an internet co., they support IE 5+ and the old pre-6 Netscape..
Why not support web browsers in general?
if you don't put this tag in html docs, what version of HTML does it
default to?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
By "it" I presume you mean HomeSite? No idea. You should always declare
a DOCTYPE, and 4.0 Transitional is probably one of the poorer choices
you can make. Try 4.01 Strict instead:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
(just wondering... because the HomeSite debugger always says that
such-and-such is longer valid in "currently active versions" (of HTML, I
suppose, although it doesn't say...))


4.0 Transitional isn't a "currently active version" by my definition.
4.01 Strict is the version to which new pages should be written.

http://tranchant.plus.com/web/html-tutorial/validation

--
Mark.
Jul 20 '05 #2

P: n/a
Frances Del Rio <fd***@yahoo.com> wrote:
when I test my stuff with the validator in HomeSite
Be aware that in technically that is not a validator.
it tells me the body tag no longer reads margin attributes..
They were never valid.
does this mean now margins are to be specified only in CSS?
Yes.
I work for an internet co., they support IE 5+ and the old pre-6
Netscape..
Okay. But does "support" = "must look identical in" ?
if you don't put this tag in html docs, what version of HTML does it
default to?
None (i.e. it's not HTML if it doesn't have a doctype) or HTML 2.0
depending on how you interpret the mess of standards and non-standards
that have been released over the years.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
(just wondering... because the HomeSite debugger always says that
such-and-such is longer valid in "currently active versions" (of HTML, I
suppose, although it doesn't say...))


The 'currently active versions' are just whatever versions you've
configured the Homesite checker to check against. The Homesite checker
doesn't care about the doctype in the document, only about how you've
configured the checker.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #3

P: n/a
On Thu, 01 Jul 2004 10:33:22 -0400, Frances Del Rio <fd***@yahoo.com>
wrote:
if you don't put this tag in html docs, what version of HTML does it
default to?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">


Just for your edification, this isn't a tag really. It's simply a
declaration of what kind of code you're using.

And preferable to what you posted above is:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

because in some cases the UA is looking for that match to knock it out of
a quirky mode.
Jul 20 '05 #4

P: n/a
DU
Frances Del Rio wrote:
when I test my stuff with the validator in HomeSite it tells me the body
tag no longer reads margin attributes.. does this mean now margins are
to be specified only in CSS?

Yes. marginheight, marginwidth, topmargin, leftmargin, etc... are not
supported by MSIE 5+ but are supported by NS 4, NS 6, NS 7. So, if you
define these attributes in your document, say, like this:

<body marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" ...>
then MSIE 5+ will have 15px of margin for top and bottom of the body
node and a 10px margin for left and right margin while NS 4, NS 6, NS
7.x, Mozilla-based browsers will have 0 margins.

One simple, obvious and reliable benefit of coding according to W3C web
standards is that you avoid all this without even knowing which browsers
and which versions of which browsers support what exactly. You just code
according to W3C web standards and you just let browser manufacturers
update and upgrade their browsers (and they do!) according to web
standards and you invite people to upgrade their browser versions (and
they do!). If you do your part, then your code will be supported and
rendered accordingly thanks to/by other complying parties.

The stupid thing about margins is that NS 4 does support CSS margins
applied to the body; people are still using, relying on invalid code
which really no longer makes any kind of sense.

http://devedge.netscape.com/library/...otes.html#5505
I work for an internet co., they support IE 5+ and the old pre-6 Netscape..

if you don't put this tag in html docs, what version of HTML does it
default to?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
By definition, a valid document requires a doctype declaration. The best
doctype declaration I recommend is using strict HTML 4.01 all the time
because it will trigger standards compliant rendering mode in all
browsers supporting doctype switching that way. In the case of MSIE 6,
this is important because in standards compliant rendering mode, it
corrects an important implementation flaw of the CSS1 box model... and
MSIE 6 is by far the most frequently used on the web.

My Web site is standard! And yours?
http://www.w3.org/QA/2002/04/Web-Quality

List of valid DTDs you can use in your document.
http://www.w3.org/QA/2002/04/valid-dtd-list.html

Don't forget to add a doctype
http://www.w3.org/QA/Tips/Doctype

DU
(just wondering... because the HomeSite debugger always says that
such-and-such is longer valid in "currently active versions" (of HTML, I
suppose, although it doesn't say...))
thank you..

Frances Del Rio
NYC

Jul 20 '05 #5

P: n/a
DU <dr*******@hotWIPETHISmail.com> wrote:
Frances Del Rio wrote:
when I test my stuff with the validator in HomeSite it tells me the body
tag no longer reads margin attributes.. does this mean now margins are
to be specified only in CSS?
Yes. marginheight, marginwidth, topmargin, leftmargin, etc... are not
supported by MSIE 5+ but are supported by NS 4, NS 6, NS 7. So, if you
define these attributes in your document, say, like this:


No. topmargin and leftmargin are supported by IE5+ just as they were
supported by IE4. (top and left were supported from IE2, but IE4 added
right and bottom). IE6 and Opera 7 later added support for left and
top but not right and bottom.

(When only top and left are specified they affect all four margins not
just the top and left ones, I'm not sure if this is true all the way
back to IE2 or whether it's a later change.)

marginwidth and marginheight were added as attributes of body (as
opposed to attributes of frame) by NN4 but are also supported by Opera
4+.
<body marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" ...>
then MSIE 5+ will have 15px of margin for top and bottom of the body
node and a 10px margin for left and right margin while NS 4, NS 6, NS 7.x,
Mozilla-based browsers will have 0 margins.
No. MSIE will also display zero margins with the above code. Try it
and see for yourself.
One simple, obvious and reliable benefit of coding according to W3C web
standards is that you avoid all this without even knowing which browsers
and which versions of which browsers support what exactly.
However, you do have to remember that in CSS terms IE and Gecko have
default margins whilst Opera has default padding.
The stupid thing about margins is that NS 4 does support CSS margins
applied to the body;


No it doesn't. Try it and see. The only CSS way of placing content
right up against the window edge in NN4 is absolute positioning.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #6

P: n/a
Steve Pugh <st***@pugh.net> writes:

[NN4]
The only CSS way of placing content
right up against the window edge in NN4 is absolute positioning.


You could as well use negative margins (might be safer e.g. in
combination with scripts, and should not break tabbing through
linkfarms).
--
| ) 111010111011 | http://bednarz.nl/
-(
| ) Distribute me: http://binaries.bednarz.nl/mp3/aicha
Jul 20 '05 #7

P: n/a
DU
Steve Pugh wrote:
DU <dr*******@hotWIPETHISmail.com> wrote:
Frances Del Rio wrote:
when I test my stuff with the validator in HomeSite it tells me the body
tag no longer reads margin attributes.. does this mean now margins are
to be specified only in CSS?
Yes. marginheight, marginwidth, topmargin, leftmargin, etc... are not
supported by MSIE 5+ but are supported by NS 4, NS 6, NS 7. So, if you
define these attributes in your document, say, like this:

No. topmargin and leftmargin are supported by IE5+ just as they were
supported by IE4. (top and left were supported from IE2, but IE4 added
right and bottom). IE6 and Opera 7 later added support for left and
top but not right and bottom.


Ok, I was not sure about these. I'll check this for sure.
(When only top and left are specified they affect all four margins not
just the top and left ones, I'm not sure if this is true all the way
back to IE2 or whether it's a later change.)

marginwidth and marginheight were added as attributes of body (as
opposed to attributes of frame) by NN4 but are also supported by Opera
4+.

<body marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" ...>
then MSIE 5+ will have 15px of margin for top and bottom of the body
node and a 10px margin for left and right margin while NS 4, NS 6, NS 7.x,
Mozilla-based browsers will have 0 margins.

No. MSIE will also display zero margins with the above code. Try it
and see for yourself.

One simple, obvious and reliable benefit of coding according to W3C web
standards is that you avoid all this without even knowing which browsers
and which versions of which browsers support what exactly.

However, you do have to remember that in CSS terms IE and Gecko have
default margins whilst Opera has default padding.


That I know.
Despite errors or imprecisions regarding supported attributes, my
reasoning regarding W3C web standards compliance is still very strong:
if you want future-proof code that can now and will later be supported
and rendered in an overwhelming majority of browsers in use out there,
then going with W3C web standards is the safe, solid, reliable way.
The stupid thing about margins is that NS 4 does support CSS margins
applied to the body;

No it doesn't.


Well, I tried setting margins many years ago on NS 4.72 on the body node
and it worked.

Try it and see. The only CSS way of placing content right up against the window edge in NN4 is absolute positioning.

Steve


That could be another issue...not sure what you mean by placing content.
I was referring to rendering of margin for the body node. This reference
supports my claim:

http://devedge.netscape.com/library/...otes.html#5505

DU
Jul 20 '05 #8

P: n/a
DU <dr*******@hotWIPETHISmail.com> wrote:
Steve Pugh wrote:
DU <dr*******@hotWIPETHISmail.com> wrote:

The stupid thing about margins is that NS 4 does support CSS margins
applied to the body;
No it doesn't.


Well, I tried setting margins many years ago on NS 4.72 on the body node
and it worked.


Zero or non-zero margins?
Try it and see. The only CSS way of placing content
right up against the window edge in NN4 is absolute positioning.
That could be another issue...not sure what you mean by placing content.


<body><div>content

I want the content div to be right up in the top left corner with no
space between it and the window frame.
I was referring to rendering of margin for the body node. This reference
supports my claim:

http://devedge.netscape.com/library/...otes.html#5505


Not really, it's very vaguely worded. The only part that would apply
in this case is "Navigator does fairly well".
NN4 is okay so long as you want to increase the default margins of any
element, but as soon as you want to reduce them you often run into
problems.

body {margin: 0; padding: 0;} simply has no effect at all in NN4. Try
it and see.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #9

P: n/a
DU
Steve Pugh wrote:
DU <dr*******@hotWIPETHISmail.com> wrote:
Steve Pugh wrote:
DU <dr*******@hotWIPETHISmail.com> wrote:

The stupid thing about margins is that NS 4 does support CSS margins
applied to the body;

No it doesn't.
Well, I tried setting margins many years ago on NS 4.72 on the body node
and it worked.

Zero or non-zero margins?


Non-zero; margin: 4% IIRC.
Try it and see. The only CSS way of placing content
right up against the window edge in NN4 is absolute positioning.

That could be another issue...not sure what you mean by placing content.

<body><div>content

I want the content div to be right up in the top left corner with no
space between it and the window frame.


Yeah.. that would be a problem since there is a gap created by
block-level elements and line-height too. You can't have text perfectly
right up in the top left corner with no space between it and the window
frame unless you use abs. positioning and there, NN 4 is known to be
weak and buggy.
I was referring to rendering of margin for the body node. This reference
supports my claim:

http://devedge.netscape.com/library/...otes.html#5505

Not really, it's very vaguely worded. The only part that would apply
in this case is "Navigator does fairly well".
NN4 is okay so long as you want to increase the default margins of any
element, but as soon as you want to reduce them you often run into
problems.


That's possible; I did not test extensively, exhaustively its support
for margins.
body {margin: 0; padding: 0;} simply has no effect at all in NN4. Try
it and see.

Steve


Argh... I am sure I did not try margin: 0 because at the time, we were
trying to create cross-browser code with MSIE 5.5 and MSIE 6.
Removing margin on the body (and padding for Opera 7.x) just makes
reading a webpage harder.

DU
Jul 20 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.