css - 背景图像不会在 Internet Explorer 中居中

标签 css internet-explorer

如果有人能帮我解决这个问题,我将不胜感激。

我有 this site在暂存链接上。在 Safari 和 Firefox 中一切正常。但是在 Internet Explorer(我相信是第 9 版)中,背景图像出现在最右边,即不在中心。

行为不端的 IE 图片:

misbehaving IE

由于每个页面的背景图片不同,代码如下

body {background-color:#000; color:#FFF; margin:0px; padding:0px;height:100%;}

#home {background:url(../images/Background2.jpg) top center no-repeat;background-color:#000;}

对于 Internet Explorer v9 或更低版本,我包括:

#home {text-align:center;}

我已经阅读了其他帖子,但似乎找不到答案。非常感谢您的意见!

最佳答案

可能是背景的隐式位置在 IE si 中向左,在 Chrome 中为中心。 尝试使用 background-position:center center

关于css - 背景图像不会在 Internet Explorer 中居中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15151789/

相关文章:

javascript - jquery 下一个 div 元素选择

html - <pre><code> 中同一行中未对齐的 <td>

jquery - CSS显示:inline animation not working using jquery addClass

javascript - 无法从 DOM 获取 NAME 属性

internet-explorer - 什么是 "Prerender requested by FlipAhead started for url: an unknown reason"?

php - 通过 PHP 发送 HTML 邮件 - 奇怪的渲染

html - 如何在 flexbox 中将一个 div 放在另一个 div 的下面

css - 自定义滚动条不会出现在 Internet Explorer 上

html - 自动流不适用于 IE 中的绝对定位 div

javascript - IE 无法将 img 加载到 HTML