Click to See Complete Forum and Search --> : [RESOLVED] Centering doesn't work in IE


narutodude000
04-12-2010, 05:56 PM
style="width:750;margin-left:auto;margin-left:auto;"

Why doesn't the above code work in Internet Explorer 8? It works perfectly in Google Chrome.

aj_nsc
04-12-2010, 06:01 PM
Two possible reasons.

I think you meant to use:

style="width:750;margin-left:auto;margin-right:auto;"


to set both left and right margins to auto.

If that doesn't work, I think I recall something about quirks mode in IE (7 at least) throwing off the ability to center block-level elements using margin: 0 auto so use the validator (http://validator.w3.org/) to validate your document

narutodude000
04-12-2010, 07:56 PM
I tried the validator, my webpage was perfect.

tirna
04-13-2010, 01:21 AM
There must be something else going on here.

Post ALL your html for the web page so we can see what doctype you declared for the validator.

You didn't state which validator you used. Was it the markup or css validator?

You might also find you need to specify the units for the width value.

narutodude000
04-13-2010, 03:43 PM
I tried lots of different methods and it turns out text-align:center worked.