View Full Version : How to replace these attributes using CSS


sparrowhawk
02-20-2006, 06:46 PM
I am trying to get my homepage to validate using the W3C validator. I have only 4 attributes that I can't seem to replace with external styles.

the attributes modify the body element:
leftmargin
topmargin
marginheight
marginwidth
so like:
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

I found a solution using absolute positioning:

body {
position: absolute;
top: 0;
left 0;
}

The problem is that I want to keep my page design centered:
http://www.ajmoss.com/
if you care to see what I mean.

Thanks in advance.

Here's the validation issue - this may explain better than I have:
http://validator.w3.org/check?uri=http%3A%2F%2Fwww.ajmoss.com%2F&charset=%28detect+automatically%29&doctype=Inline&ss=1&outline=1&sp=1&noatt=1&No200=1&verbose=1
(I hope it's ok to link to the W3C validation tool)

RyanSmith
02-20-2006, 07:47 PM
Check out:
http://maxdesign.com.au/presentation/page_layouts/

They have lots of neat tricks for layouts in CSS

http://www.petefreitag.com/item/475.cfm

also has some neat CSS tricks. I think what you probably want to do is get rid of the table and replace it with a DIV that has

margin: 0px auto 0px auto;

Or something like that.

sparrowhawk
02-20-2006, 07:58 PM
[QUOTE=RyanSmith]Check out:
[url] I think what you probably want to do is get rid of the table and replace it with a DIV that has

margin: 0px auto 0px auto;

Or something like that.[/QUOTE]

That would work, and I've thought about redesiging the whole site using <div> tags, and css positioning. I was just wondering if there is a way to modify the body element and accomplish the same effect while still keeping the tables.

can I apply the above to the body element - like:
body {
margin: 0px auto 0px auto;
}
???

sparrowhawk
02-20-2006, 08:02 PM
I realized I was being a jerk asking when I could just try it out. That worked great and now my page totally validates. Thanks so much.

jlknauff
02-22-2006, 05:30 AM
And it would have taken less time too ;)

catanich
01-23-2007, 01:42 PM
How about the following

body {
margin-top: 10px;
margin-right: 10px;
margin-bottom: 10px;
margin-left: 10px;
}

and replace the 10px to 0 px. This validates.

Jim Catanich