View Full Version : CSS Styling issue IE8 Centering a DIV

09-13-2011, 01:16 AM
Hi all .

I have an issue with a site I am building at the moment which is causing me some pain. I am able to centre a div perfectly in firefox and Chrome. but for some reason, in good old IE8 its totally skewed and my form ends up one one side of the page and the background for it on the other.

I think this is additional margin coding issues. but could someone advise best way to fix this please.

Thanks in advance.

link is at http://snaplife.co.uk/client/errorlogin.html


09-13-2011, 08:33 AM
Define DOCTYPE and hopefully it will work...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Also <style> tags must be in <head> tags only.

</body> tag is appearing twice...

validate your site on http://validator.w3.org/ . There are lots of errors.

09-13-2011, 08:41 AM
look at you html code, line 132. There is nothing in the div. code that you then could use in the div to centre it looks something like this:

<div id="div1" style="margin-left:auto; margin-right:auto;">

//content goes here


hope this helps