Problems with validation

liunx

Guest
Back in December, there was a post '.. Make the gaps stop' by 'cdxrevvved' where some suggestions about validation were given. I validate my pages using Homesite and thought I would try <!-- m --><a class="postlink" href="http://validator.w3.org">http://validator.w3.org</a><!-- m --> as suggested in that post.

I got the a few minor errors regarding 'alt' in my image tags which were easily fixed but I got two additional errors that I am unable to resolve.

1.
<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0"> which was suggested by Zach Elfers that I've been using for a long time.

Stefan responded with.....

Now we can rip out that proprietary crapcode you just added (marginheight="0" marginwidth="0" leftmargin="0" topmargin="0")

and suggested the use of..

body {margin:0;}

But this does not work in NS4xx. Is there a 'valid' fix other than don't use NS4xx, upgrade?

2.
I use the following in-line script to insert a date on numerous pages ('today' is derived in an external script)

<script language="JavaScript1.2" type="text/javascript">
<!--
document.write('<div class="date">'+today+'</div>');
//-->
</script>

The validator flags </div> stating that there is no starting <div>. What's the problem?1. That should really be body {margin:0px} and users of version 4 browsers do need to upgrade. However, said users - and users in general - really don't give a south end of a north bound rat about your margins.

2. It sounds like there might be something else going on, but try the following:

<script type="text/javascript">
<!--
document.write('<div class="date">'+today+'<\/div>');
//-->
</script>
And note that using the LANGUAGE attribute with the SCRIPT element will put Netscape in a special standards non-compliant mode. Said attribute was depricated for a reason and unless you're using some legacy DTD the validator ought to flag that.Thanks Charles. The <\/div> solved the second part. It's possible that the <div class="date"> was not considered a valid opening <div> tag!


users of version 4 browsers do need to upgrade. However, said users - and users in general - really don't give a south end of a north bound rat about your margins.


Here's why (I think) I need to zero the margins.
I'm using a 'repeat-x' background image at the top of my page which needs (I want) to go up against the edge. I then match other images over the top of this. So the position of these images is important. In addition, on other pages, I use 'position:absolute' (required if using DHTML in NS4xx) to position other image-type effects that need to match over existing images.

If I do not zero the margins, the images do not position correctly. Also the 'default' margin in NS4xx seems to vary depending
on screen size so I cannot use the defaults as a starting point. Does that make sense??Don't need a unit when the value is 0. Also use 'padding: 0' since Opera applies padding, not margin, to body by default.

The usual hack for NS4 is as follows. It will get rid of the left and top margins. You are stuck with the right margin, but that's mostly good enough.


body { margin: -10px 0 0 -10px }
html body { margin:0; padding: 0 } /*Nav doesn't get this*/Perfect!! Thanks.
 
Back
Top