Margins

  • Thread starter Thread starter Stephen
  • Start date Start date
S

Stephen

Hi,

I downloaded a free website template and tested the code
with NetMechanic. The test indicated the margins were a
problem with Brower Compatibility. The original margins
were "5" but I've changed them from 0 to 40 and the test
still continued to show Brower Compatibility problems.
Does anyone know if I should worry about this?

Here is the line of code that is a problem:

<BODY text=#000000 vLink=#000080 aLink=#000080
link=#000080 leftMargin=5
topMargin=5 MARGINHEIGHT="5" MARGINWIDTH="5">

Thanks for any help.

Stephen
 
Hi Stephen,

The code you have will work fine for all browsers out there. However
technically it's not valid code - in theory the "correct" way to do this is
<style type="text/css">
body{
margin: 5px;
}
</style>
<body>
.....your page
</body>

This method becomes an issue if you try to remove margins completely - the
"correct" method would be
body{
margin:0;
}
However this will fail in NN4 - this
<body marginwidth="0" marginheight="0" leftmargin="0" topmargin="0">
Will work in NN4 (and anything else) but fail validation. Sometimes there's
a decision to be made between do you want code that's valid or do you want
code that supports older browsers (ie Netscape 4) there's no right or wrong
answer - pays your money and takes your choice :-)
 
Hi, Jon,

Thanks a lot for your help.

We would probably opt for code that works on newer
browsers as almost all of the prospective clients looking
at our site would have fairly new computers.

But as a thought, could you please tell me which code
would be best for a Google robot? That would be the one
we would choose.

Thanks again,

Stephen
 
<BODY text=#000000 vLink=#000080 aLink=#000080
link=#000080 leftMargin=5

The proper way to write part of this code is:
leftMargin="5" topMargin="5" i.e. same as MARGINHEIGHT and MARGINWIDTH, with
" ". It is quite possible that this inconsistency caused the warning.

This by the way has little to do with Google criteria as a search engine.
And no need to worry about Netscape 4 users...if there are indeed such people.
 
Hi,

This is irrelevant for Google it will be happy either way. I tend to agree
with you about accomadating newer browsers - that's what I do myself.
 
Of course there are Netscape 4 users. The proper way to write this margin
code would be like this -

Link to an external stylesheet (using DW's CSS editor), or embed a
stylesheet in your code (between <head> and </head>) with the following
style in it (embedded shown for cut-n-paste convenience) (assuming you want
zero margins) -

<style type="text/css">
<!--
body { margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left:
0px; padding:0px; }
-->
</style>

you could also try

body { margin : 0px 0px 0px 0px; padding:0px; }

or

body { margin : 0px; padding:0px; }

as a shorthand method.

This will take care of the margins in IE4+ and NN6. To take care of NN4x,
you will need to use MODIFY | Page Properties... and set the two right hand
margin fields (marginwidth and marginheight) to 0 (DMX and below).

Since you are still using inline margin specs in the body tag, this method
won't validate (and is not easy to do in DMX2004). To get completely valid
code that works for all
browsers in any version of DW, change your stylesheet as shown below -

body {
padding: 0;
margin: 0 -10px 0 -10px;
/*/*/margin: 0 0 0 0; /* */
}
 

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

Back
Top