Forum : Problem in DIV tags allignment with IE
Brief description  about Online courses   join in Online courses
View Pradeep  Kumar 's Profile

Problem in DIV tags allignment with IE

Hello Sir,
In all the CSS assignments with DIV tags i m having some allignment problem with IE. with Mozilla firefox they are working fine but not with IE.

In every assignment i am using a container division having a width of 70% alongwith margin: auto, that makes the division to align in the center of the browser. but in IE the division remains intact i.e on the left hand side of the browser.
Is their any setting which needs to be changed in IE or is their any other issue.

Please help

Regards
Pradeep
Asked by Pradeep Kumar | Sep 17, 2009 |  Reply now
Replies (3)
View teacher siliconindia 's Profile
<link href="homeoutside/formozilla.css" rel="stylesheet" type="text/css" />
<link href="homeoutside/forie.css" rel="stylesheet" type="text/css" />
<link href="homeoutside/forie7new.css" rel="stylesheet" type="text/css" />


<!--[if IE 6]>
<link href="homeoutside/forie.css" rel="stylesheet" type="text/css" />
<![endif]-->

<!--[if IE 7]>
<link href="homeoutside/forie7.css" rel="stylesheet" type="text/css" />
<![endif]-->


We use the above code to overcome the browser compatibility issue.

How it works is. We have 3 different style sheets for IE6, IE7 and Mozilla.

First style sheet "formozilla.css" will work as the master style sheet. If you need any changes to be made in the master css file to adjust IE6 or IE7 just add the same id in the css file for IE6 and make the style change there.

So when the browser reads if that browser is IE6 it will compare both the style sheet, master style sheet and the IE6 style sheet. So if the browser find any change in the CSS file for IE6 it will take that particular style.

The beauty is Mozilla's style sheet will work for all other browsers other than IE. But IE6 style sheet wont work for IE 7 also. Hats off to microsoft :-)
Sep 22, 2009
View pradeep kumar 's Profile
Thank you Bikash... i got it now. thanks alot
Sep 19, 2009
View bikash kumar singh 's Profile
There's bug in IE'S way of handling margins. To fix this use the dtd declaration as the first line of the page and margin:0 auto;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Read CSS->align section on http://w3cschools.com and you will understand better.
Sep 18, 2009