【问题标题】:background-position in explorer 9资源管理器 9 中的背景位置
【发布时间】:2011-12-22 08:15:42
【问题描述】:

我在定位正文背景时遇到问题。它是这样的:

<script type="text/javascript">
    <!--body id="body" style="
        text-align:center;
        background-color:#031a43;
        background-image : url('design/bgFrontPage.jpg');
        background-repeat:no-repeat;
        background-position: top center;" //-->
</script>

在所有浏览器中都可以正常工作,除了 IE 9,其中 bg 向左移动。

有什么想法吗?

【问题讨论】:

  • 你试过用 Firebug 调试吗?
  • 你的代码已经够奇怪了。你确定 JS 解析器接受 CSS 吗?

标签: html css internet-explorer-9


【解决方案1】:

很奇怪。

我在我的页面中尝试此代码:

<head>
    <title></title>
    <style type="text/css">
        .bg
        {
            text-align: center;
            background-color: #031a43;
            background-image: url('Styles/166894621.jpg');
            background-repeat: no-repeat;
            background-position: top center;
        }
    </style>
</head>
<body class="bg">
</body>

背景图片位于中心。

【讨论】:

    【解决方案2】:

    我希望 IE9/any 可以通过在 html 的头部添加下面的 meta 行来呈现为 IE8

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

    【讨论】:

    • 对于现有的崩溃网站来说,这是一个权宜之计。在新内容上主动使用它是个坏主意。
    猜你喜欢
    • 1970-01-01
    • 2013-11-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多