简体   繁体   中英

center div using margin

im trying to center a div(only horizontal) using the following css

.body_div 
{

  width: 900px;
  margin-left:  auto;
  margin-right: auto;
  background-color: #f8f3ed;
}

and it does it work in chrome and ff but not in ie

take a look here

eventually i used the same code in another site too and it worked well in ie too

now a hell lot another problem... the borders around the #courses and #call are not shown in ie... thanks

Remove the comment before the DOCTYPE. That places IE in quirks mode where it doesn't supports all standards.


These are currently the top lines of your site:

<!--
To change this template, choose Tools | Templates
and open the template in the editor.
--> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

Change them to this:

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

使用单个边距设置:

margin: 0 auto;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM