...

View Full Version : margin: auto for ie



jayemvee
06-01-2007, 04:36 AM
I have a background image that repeats to border the left and right side of my content... the content is wrapped with

.wrap800{
width: 800px;
margin-left: auto;
margin-right: auto;
}

and in mozilla it works.. as usual.. in IE it looks like it needs to be shifted 5px right.

What do I do?

vanilladesign
06-01-2007, 05:15 AM
Well first of all to simplify your code you can use



.wrap800{
width: 800px;
margin: 0 auto;
}

The way I get IE to behave properly is to make another <div> to wrap around the other one with a text-align:center;
So it will look like:



.wrap800{
width: 800px;
margin: 0 auto;
}

.wrapper{
text-align:center;
}


And simply nest the .wrap800 inside the .wrapper div. Hope this helps.

VIPStephan
06-01-2007, 07:53 AM
Uhm… not sure if this is a good idea as you are adding a useless empty div. Can you post a link to your problem (for better imagination thereof)?

_Aerospace_Eng_
06-01-2007, 08:15 AM
Its your doctype. You are either lacking one or using a partial one. Coding properly to begin with saves from dealing with simple issues like this. Use a full doctype. I recommend this one

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

Also I recommend using different naming techniques on your class and/or ids. They need to be descriptive but something like wrap800 doesn't work to well because what if you decide to go bigger or smaller? Sure its probably only there one time but for other classes and ids you'll have to change them. Make them meaningful.

jayemvee
06-14-2007, 06:00 PM
I totally agree with you... That was a quick and dirty thing. Thanks for the help.. it works



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum