Forum Moderators: open

Message Too Old, No Replies

any way to have 0 margins

and still validate in NS4?

         

RussellC

1:13 pm on Sep 19, 2002 (gmt 0)

10+ Year Member



Topic says it all. Thanks.

tedster

1:21 pm on Sep 19, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry to say, one word gives the only answer I've found - "no".

starway

8:43 am on Sep 20, 2002 (gmt 0)

10+ Year Member



To have 0 margins - where?

RussellC

10:04 pm on Sep 20, 2002 (gmt 0)

10+ Year Member



Sorry, I meant on the whole page. leftmargin=0 topmargin=0 etc.. in the <body> tag

I hate when my code dosnt validate but I am writing a new site with a a dynamic menu that is positioned a certain way that when NS4 has margins it is in the wrong place.

diddlydazz

10:59 pm on Sep 20, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



try this:

<body marginwidth="0" marginheight="0" leftmargin="0" rightmargin="0" bottommargin="0" topmargin="0">

That will position correctly in NN47, IE, Opera and NN7.0

hope this helps

Dazz

Key_Master

11:09 pm on Sep 20, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Why not use CSS?

pageoneresults

11:32 pm on Sep 20, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You have to put everything in one main <div> and then give that a class that has absolute positioning. So, it might look like this in your html...

<body>

<div class="main">
Content
</div>

In your css...

div.main{position:absolute;top:0px;left:0px;width:750px;}

Since I work with absolute positioning of elements, this has worked great for me. Not sure how it stands up against relative positioned elements.

> <body marginwidth="0" marginheight="0" leftmargin="0" rightmargin="0" bottommargin="0" topmargin="0">

Won't validate.

[edited by: pageoneresults at 11:33 pm (utc) on Sep. 20, 2002]

NameNick

11:32 pm on Sep 20, 2002 (gmt 0)

10+ Year Member



diddlydazz

Your suggestion would work, but the HTML validator will cry.

Key_Master

Why not use CSS?

Yeah, CSS works great. Except for Netscape 4.x.

Greetings NN

Key_Master

12:15 am on Sep 21, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How does this work for you?

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

[edit]Tweaked code[/edit]

tedster

2:21 am on Sep 21, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Wow, Key_Master! You've just slain the "four horsemen of non-validation."

Non-valid body tag for Netscape 4

<body leftmargin=0 topmargin=0 marginheight=0 marginwidth=0>

....replaced by......

Valid CSS code - works in Netscape 4

body {
position:absolute;
top:0px;
left:0px;
margin:0px;
padding:0px;
}

I never put absolute positioning together with zero padding and margin before. It works!

[edited by: tedster at 2:29 am (utc) on Sep. 21, 2002]

pageoneresults

2:25 am on Sep 21, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Slayer!

I was wondering about that css and wanting to get around to test it. Thanks for verifying tedster. And Key_Master, shall we call you Slayer from now on! ;)

tedster

2:40 am on Sep 21, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've just added this solution to the Generic CSS thread [webmasterworld.com], along with a credit to Key_Master.

Key_Master

3:04 am on Sep 21, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks guys, it just goes to show that it is possible to win Netscape 4 over with CSS.

palmpal

6:24 am on Sep 21, 2002 (gmt 0)

10+ Year Member



Hello,

I tried your suggestion on one of my pages and I had a problem with the background not extending fully on the right side. In addition, the bottom right graphic in my table no longer displays. Any suggestions?

Thanks,

Mona

Key_Master

1:54 pm on Sep 21, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



palmpal,

I think if you take a closer look at the way the CSS works you'll notice it does a better job of removing the right margin in Netscape 4 than <body marginwidth="0" marginheight="0"> does. The right margin can't be fully removed in Netscape 4 although the CSS does make it more narrow. It's more noticable if you use a body background color for testing purposes.

As far as your graphic goes I can't duplicate the effect. What browser are you using and how are you positioning the image/table?

palmpal

2:26 pm on Sep 21, 2002 (gmt 0)

10+ Year Member



Browser tested - Netscape 4.08. Part of my source is shown below:

<BODY>
<TABLE CELLPADDING="0" CELLSPACING="0" WIDTH="100%" BORDER="0" ALIGN="center">

This is the beginning of the table. The bottom row appears below. The last background graphic disappears when I include "position: absolute" in the CSS. When I exclude the statement the graphic reappears. Strange huh?

<TR VALIGN="top">
<TD WIDTH="237" CLASS="bg51" HEIGHT="68">&nbsp;</TD>
<TD WIDTH="50%" CLASS="bg52" HEIGHT="68">&nbsp;</TD>
<TD WIDTH="475" CLASS="bg53" HEIGHT="68">
<P ALIGN="center" STYLE="margin-top: 32px">
<IMG SRC="copyright.gif" ALT="Copyright 2002 Company and its licensors. All rights reserved." width="361" height="13"></P></TD>
<TD WIDTH="50%" CLASS="bg54" HEIGHT="68">&nbsp;</TD>
<TD WIDTH="33" CLASS="bg55" HEIGHT="68">&nbsp;</TD>
</TR>
</TABLE>
</BODY>

</HTML>

The margin set for my copyright notice is necessary since it "floats" over the background image which consists of three horizontal bands (the middle band is white so the copyright notice shows up best here.)

Thanks for commenting!

Mona

[edited by: tedster at 4:14 am (utc) on Sep. 22, 2002]

Key_Master

2:47 pm on Sep 21, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try using this instead and see if it works:

<P ALIGN="center" STYLE="padding-top: 32px">

palmpal

4:57 pm on Sep 21, 2002 (gmt 0)

10+ Year Member



Hello,

I tried your suggestion but no luck. Also, I checked a few of the other pages on the site and noticed that some of my CSS settings failed to render the correct font settings. On one page the entire bottom row of background graphics disappeared.

Is there a way to share my temporary URL so you can take a look at my site?

Thanks,

Mona

Slade

9:13 pm on Sep 21, 2002 (gmt 0)

10+ Year Member



You can set in your profile (under control panel, at the top of the page).

palmpal

11:53 pm on Sep 21, 2002 (gmt 0)

10+ Year Member



Done! I'll add the position statement to my CSS so you can see the affect on some of my pages.

Thanks for any comments. (Be kind since this is my first website!)

Mona

Key_Master

2:13 am on Sep 22, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



palmpal, this will fix the problem you are having.

Add this to your CSS:

#copyright {
position: relative;
top: 32px;
}

Then make the following replacement:

<TD WIDTH="475" class="bg53" HEIGHT="68"><div align="center" id="copyright"><IMG SRC=
"copyright.gif" ALT="Copyright 2002 Company and its licensors. All rights reserved." width="361" height="13"></div></TD>

[edited by: tedster at 3:19 am (utc) on Sep. 24, 2002]
[edit reason] remove company name [/edit]

palmpal

5:20 am on Sep 22, 2002 (gmt 0)

10+ Year Member



Key Master,

I made the changes - problem fixed! Thank you very much for taking the time to look at my pages.

It appears I still have one more problem with my FAQ page. I have isolated it to the 3rd row, middle cell. I have a table with my bullets in one column and my questions in the second column. If I delete the Text Align="left" statement then the missing images return. I tried doing a DIV Align="left" and the graphics come back but my text won't left align! Any suggestions?

Thank you again!

Mona

palmpal

12:58 pm on Sep 22, 2002 (gmt 0)

10+ Year Member



OK I have it fixed. I took a look at my DIV Class Nh3 and of course that had the text-align set to center! Duh! I set up another class and changed the alignment to left. I must have needed more coffee!

Thanks,

Mona

RussellC

5:20 pm on Sep 23, 2002 (gmt 0)

10+ Year Member



Thanks for much for figuring this out you guys, but I have a slight problem, the minute I put this:

body{
position:absolute;
top:0px;
left:0px;
margin:0px;
padding:0px;
}

in my css, none of the other stuff works in NS4 like my <h1> styles and <p> styles etc.. anyone know why?

Thanks,

BlobFisk

6:06 pm on Sep 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Apologies - complete and utter nonesense! I'm going home now...

<edited>Removed complete jibberish</edited>

[edited by: BlobFisk at 6:48 pm (utc) on Sep. 23, 2002]

pageoneresults

6:19 pm on Sep 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



> Try removing the position, top and left attributes...

I believe that is what is controlling the page margins for Netscape.

RussellC

7:23 pm on Sep 23, 2002 (gmt 0)

10+ Year Member



The margins are fine, they work great now. But since I put that code in, none of my other css stuff works. I think it has to do with the body{position:absolute;} statement. ANy ideas? Thanks.

RussellC

11:33 pm on Sep 23, 2002 (gmt 0)

10+ Year Member



any ideas? Thanks

Key_Master

11:46 pm on Sep 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you are referring to the site in your profile, make sure the external stylesheet was uploaded in ASCII form.

RussellC

1:37 am on Sep 24, 2002 (gmt 0)

10+ Year Member



I am not referring to that site, but I will try that when i get to work tomorrow. Thanks.
This 54 message thread spans 2 pages: 54