[英]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.