Click to See Complete Forum and Search --> : margin auto problem with IE


r0k3t
06-04-2008, 09:33 AM
OK - I am stuck!!! I have done this so many times now I cannot get this work in IE.

Can someone please take a a look at http://www.freedoniagroup.com/sla2008/index.html and point out what is wrong? I am really frustrated, it looks fine in Firefox but in IE7 I don't seem to have any margins - everything gets forced to the left...

Thanks!

Declan1991
06-04-2008, 03:53 PM
You are testing in IE 6?
If it is the centering you are talking about, put text-align:center; on the body tag, and text-align:left on the first div. IE 6 with text-align:center; will center block level elements (i.e. div) and doesn't implement margin:auto; properly.

WebJoel
06-04-2008, 07:28 PM
html {margin:0 auto; padding: 0;} Why are you trying to 'center' an element that is by default, 100% width? It isn't error, but it is redundant.
You'd be better off (with a valid !doctype, which you have) to put "margin:0 auto;" on a fixed-width DIV or TABLE, and center that...

Maybe you're trying to remove "margin" and "padding", but "html" and "body" both have IE-default "margin" & "padding".

In fact, IE has default margin/padding, for everything. Use the universal selector instead:

* {margin:0; padding:0;}

and remove margin & padding, from everything. You will have to re-state all your element's values (h1-6, p, form, etc etc) for margin & padding, but now, it will be the same for ALL browsers. :)

r0k3t
06-05-2008, 12:03 PM
Funny - I finally found it. I accidentally put in <style> instead of <style type="text/css"> which IE doesn't seem to like.