Forum Moderators: open

Message Too Old, No Replies

Odd validation results

Validator tells me to throw away essential code...!

         

Rob_1978

7:09 pm on Dec 11, 2002 (gmt 0)

10+ Year Member



Hi,

I have found when validating a HTML page that the line:

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

is being flagged. All of the attributes are claimed to be invalid but when I test the page with out them the lay out (designed for 800x600) suddenly shifts out of place!

Additional the validator also complains about the use of the background attribute in a TD cell (i.e. <TD CLASS="nonprintable" background="./gr/middleleft.gif"> ) despite the fact that this is an essential part of the template!

I am using HTML 4.01 Transitional. Is this a correct doctype for this kind of code?

Thanks in advance,

Rob

[edited by: Rob_1978 at 7:17 pm (utc) on Dec. 11, 2002]

Macguru

7:13 pm on Dec 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am no validation monk, but I keep the first body margins "mistake". I believe nn4 dont dig this in CSS.

For the second, I would try to remove quotes from BG image attributes.

korkus2000

7:18 pm on Dec 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Mac's got it. Instead of the body attributes use this css:

body {
margin-left : 0;
margin-right : 0;
margin-top : 0;
margin-bottom : 0;
}

It doesn't work in nn4, but its valid an should stop the shift. I don't know about the background attribute.

Nick_W

7:19 pm on Dec 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Whereas I'm not clear on every aspect of this DTD without running stuff through the validator, I do know this:

CSS [webmasterworld.com] [/url] is your friend ;)

// In your css file


[pre]
body {
margin: 0;
padding: 0;
}
.tdimage {
background-image: url(/path/to/pic.gif);
}
[/pre]

Read more on Margins [w3.org], Padding [w3.org] and Background Properties [w3.org] at the W3C's CSS Section [w3.org]

Nick

<edit>Typo!</edit>

[edited by: Nick_W at 7:24 pm (utc) on Dec. 11, 2002]

Macguru

7:19 pm on Dec 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I believe the background image attibutes are better left to CSS without quotes.

<added>Nick_W beat me!</added>

g1smd

8:12 pm on Dec 11, 2002 (gmt 0)

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



The codes that you highlighted in item 1 are browser specific tags.

I often leave such code in my pages. You could replace them with the css as suggested, but then you are aren't going to be compatible with Netscape.

I use the validator purely to find spelling typos in tags, wrongly nested tags, tags open but not closed, and other errors with the logic, structure and syntax of the HTML. I don't usually worry about including a few tags that are browser specific.

I don't really see these as errors, but more as browser incompatibilities, ones that will need to be addressed only when more browsers actually follow the agreed standards.

[edited by: g1smd at 8:19 pm (utc) on Dec. 11, 2002]

pageoneresults

8:17 pm on Dec 11, 2002 (gmt 0)

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



I've found that doing this will address all issues relative to margins in all browsers that I tested including NN4.x...

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

Macguru

8:19 pm on Dec 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Mhh! good food!

Thanks pageoneresults. I am going to try this one.