HTML 4.01 and margins..

He has: 1,016 posts

Joined: May 2002

Hi,

I thought I try to validate my new site using the W3 validator and it keeps telling me that there is no attribute "LEFTMARGIN" for this element. It gives me the same for "topmargin", "marginwidth" and "marginheight". Does HTML 4.01 not support these in the body tag? It seems to work just fine in the browsers. Maybe I need to set these using CSS?

PS. The only reason I'm validating the code is because it's going to be a webmaster site and I guess it would look bad if it failed to validate Laughing out loud

Busy's picture

He has: 6,151 posts

Joined: May 2001

the margins, left, right, top bottom ... have never been apart of the standards (wont valiadate)
CSS is your friend Laughing out loud.

Quote: PS. The only reason I'm validating the code is because it's going to be a webmaster site and I guess it would look bad if it failed to validate Laughing out loud

Then shouldn't you be using XHTML Wink

The Webmistress's picture

She has: 5,586 posts

Joined: Feb 2001

But if you only use CSS for it NS4. doesn't recognise it

Busy's picture

He has: 6,151 posts

Joined: May 2001

NS4.7 does not sure about anything under thou

The Webmistress's picture

She has: 5,586 posts

Joined: Feb 2001

So exactly how do you set it with css then?

He has: 1,016 posts

Joined: May 2002

Quote: Originally posted by Busy
[BThen shouldn't you be using XHTML ;)[/B]

You are very right. The reason I didn't however is because when I created a new XHTML document in DreamWeaver, it added the line <?xml version="1.0" encoding="iso-8859-1"?> which gives errors becasue the file is actually a PHP file.

Busy's picture

He has: 6,151 posts

Joined: May 2001

I found it just the other day but then decided not to use it now I can't find what I used. Took me ages before to find it but something works Smiling

**DOH, gotta find it**

[edit]Had a quick look before dinner, can't find it, So assume I was wrong until I can prove otherwise, sorry[/edit]

dk01's picture

He has: 516 posts

Joined: Mar 2002

I dunno if you are still looking for this but here is what I beleive you are looking for.

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

You might actually only need one of the ones above. Can't remember at the moment so i put both.
-dk

He has: 1,016 posts

Joined: May 2002

The CSS margin's doesn't work in Opera 6.04 either and I if I put the margins int the body tag, then I can't put the W3C logo on the website. What to do?

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

The padding peroperty dk01 listed is needed for Opera, so if you put both in the code should work in all modern browsers.

Edit: And I wouldn't worry about having default margins showing in older versions of NS 4.

He has: 1,016 posts

Joined: May 2002

Thank you very much, the padding did wonders Laughing out loud

PS. I'm not worried about NS 4.x users. The way I see it, if the website doesn't work for them, they have only themselves to blame for using such poor excuse for a browser. Why should I be the one spending hours and dealing with all the headaches that piece of **** causes. Get a better browser!

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Couple of tidying up comments:

1. Don't use unit measures with zero values in the CSS -- padding: 0; is fine.

2. <? xml...> is optional. You can remove it without causing any problems whatsoever. It's NOT recommended for php pages because, well, the page won't work. Smiling

hth,

S

He has: 1,016 posts

Joined: May 2002

Well, I found a way around it (actually DW did it itself).

<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
'

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

ah, interesting solution. thanks!

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.