【问题标题】:Div not aligned in the center in Internet Explorer 9在 Internet Explorer 9 中,Div 未在中心对齐
【发布时间】:2013-05-11 00:06:42
【问题描述】:

我正在开发一个网站,除 IE 外,在 Firefox、Chrome 等中一切正常。我正在使用 Ryan Fait 的 Sticky 页脚方法,并且我的主 div 上有以下样式:

#bigcontent{
    width: 920px;
    margin: 0 auto;
    padding: 20px;
    background-color: #f0f0f0;
    /* etc etc */
}

页脚代码:

.footer{
    background-color: #585858;
    color: #fafafa;
    padding-top: 20px;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: 220px;
    height: auto;
    width: 100%;
    box-sizing: border-box;
    -webkit-box-shadow: inset 0 4px 4px -2px #333;
    -moz-box-shadow: inset 0 4px 4px -2px #333;
    box-shadow: inset 0 5px 5px -2px #333;
}

我使用<!DOCTYPE html> (html5 doctype) 我真的不知道是什么问题。

最奇怪的是。我的主页居中很好。我没有在那个页面上使用#bigcontent,所以它应该是那个特定div的问题。

外观截图:

-- 删除的图片--

【问题讨论】:

  • 您应该在问题中添加一些标记,帮助我们重现此问题。
  • 你需要什么?问你需要什么,我会提供代码。
  • 如果可能的话,最好是指向重现问题的 jsFiddle 的链接。
  • 会尝试解决这个问题。
  • 嗯。它在 jsfiddle jsfiddle.net/q5dpr/1 中工作

标签: html css internet-explorer google-chrome


【解决方案1】:

您是否尝试过强制 IE 进入标准模式?将此添加到您页面的<head>

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

【讨论】:

    【解决方案2】:

    我认为您在兼容模式下看到了带有 IE 的网站。按 F12 并检查Browser Mode

    【讨论】:

    • 我的浏览器模式是 Internet Explorer 9。所以这不是问题。
    • @KeesSonnema Document Mode 怎么样。是否设置为Standards
    猜你喜欢
    • 2013-02-02
    • 1970-01-01
    • 2016-10-16
    • 1970-01-01
    • 1970-01-01
    • 2012-06-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多