[英]IE8 alignment problem. Usercontrol in div wraps down. happens only in IE8, works fine in FF, chrome, IE7
[英]Simple CSS Centering Problem only on IE7, Chrome and FF Fine
我在IE7上的居中div出现问题...在Chrome和Firefox上,它可以正常工作。
这是网站,它在Volusion.com上,所以对我来说这是一个古老的平台,请放轻松:)
一切都在一个主要的div中:
<div id="MainDiv">
这是CSS
#MainDiv {
background-color:White;
border:1px solid black;
margin:0 auto;
width:960px;
}
无论如何,如果您需要查看更多详细信息,请使用Firefox中的FireBug进行检查,但是应该是这样...
因此,最重要的是,div集中在Chrome和Firefox上,但是一直在IE7上向右...我不确定该怎么做CSS(特别是“ margin:0 auto;”通常对我有用)
非常感谢您的宝贵时间。
您处于怪癖模式 。 如果要使自动页边距(或其他功能)在IE中工作,请添加标准模式DOCTYPE。
我以前遇到过这个问题-对我而言,这一直是可靠的解决方案;
body{
text-align:center;
}
#MainDiv {
text-align:left;
margin:0 auto;
background-color:White;
border:1px solid black;
width:960px;
}
您缺少doctype 。
将其添加为html文档的第一行,它将解决该问题:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
有趣的是,昨天我被要求在办公室解决完全相同的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.