IE不支持背景图像属性

时间:2013-12-24 10:20:28

标签: html css

我的代码

<span class="iconCloud deactiveImage" src=""></span>

CSS

.deactiveImage {
            background-image: url("./Images/off.png");
            height: 35px;
            width: 35px;
        }

图片未在IE中显示。请帮助..纠正chrome和firefox

2 个答案:

答案 0 :(得分:3)

span默认为inline元素,heightwidth将不受尊重,因此请blockinline-block

.deactiveImage {
    background-image: url("./Images/off.png");
    height: 35px;
    width: 35px;
    display: inline-block;
}

答案 1 :(得分:1)

您可以在css中使用display:block来显示带有以下css的图像:

 <style type="text/css">
.deactiveImage {
        background-image: url("/Images/test.png");
        height: 35px;
        width: 35px;
        display:block;
    }
</style>
相关问题