注册 登录
编程论坛 WEB前端(UI)

刚学做网页.用火狐能居中用ie怎么就不能居中了?求各路大神指教!

随风之恋11 发布于 2012-09-30 13:58, 1220 次点击
以下是CSS的代码:
body{
   margin:0px;
   padding:0px;
   font:12px Arial,宋体;
   text-align:center;
  }
 
#container{
            margin-left:auto;
            margin-right:auto;
            width:960px;
            background:green;  /*linshi*/
            text-align:left;
            
}
以下是html的代码:
<html>
<head>
      <title>divcss</title>
      <meta http-equiv="Content-Type" context="text/html"  charset-utf-8>
      <link rel="stylesheet" type="text/css" href="CSS/layout.css">
      
</head>
      <body>
        <div id="container">
           <div id="header">
           </div>
           
           <div id="main">
           </div>
           
           <div id="footer">
           </div>
        
        </div>
      </body>
</html>

3 回复
#2
编程客2012-12-13 18:12
样式中加

程序代码:

html,*
{
    text-align:center;
}
#3
叹服vae2013-08-25 16:09
margin:0 auto;
1