html - 背景图像大小在 IE 8 中不起作用

标签 html css background

我的html代码

<div id="content_main"></div>

CSS

        #content_main
{
    width:1024px;
    height:150px;
    background:url('../images/Orange.jpg');
    background-repeat:no-repeat;
    background-size:1024px 150px;
    -moz-background-size: 1024px 150px;
    -o-background-size: 1024px 150px;
}

背景大小在 IE8 中不工作,如何解决这个问题,我不知道,请帮助我。

最佳答案

IE8 不支持背景图像选项。您可以使用 caniuse.com网站查看各种 HTML5 功能的浏览器支持矩阵,例如 background-size .或者,如果需要 IE8 支持,您将需要使用 <img>标签设置在您的 <div id="content_main"> 后面

按照@ahsan 的建议查看 this other similar question其中包含一些 polyfill 建议和一个 ms-filter background-size 的解决方法在 IE8 中

关于html - 背景图像大小在 IE 8 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11200887/

相关文章:

javascript - 仅当单击单选按钮 1 时启用文本框

jQuery + Bootstrap Navigation Bar - 如何在访问时突出显示链接

javascript - 如何让 opera mini 不缓存 css?

css - 使用 CSS 实现视差滚动

html - bootstrap 3 无法更改背景图片

html - 如果元素处于固定位置,为什么 block 元素不会展开以适应父元素的宽度?

android - 软件键盘显示时如何保持背景图像大小

html - 具有透明图像和渐变的 Css 背景

javascript - 多个谷歌图表

javascript - 具有多个属性的 css 转换适用于 firefox 但不适用于 chrome