I'm new to CSS, trying to display an image through with following code, it works in Chrome and FireFox but not in IE 9. When I remove position attribute, it shows image in IE9. Any help is appreciated !
我是CSS的新手,尝试使用以下代码显示图像,它可以在Chrome和FireFox中使用,但不能在IE 9中使用。当我删除位置属性时,它会在IE9中显示图像。任何帮助表示赞赏!
<div style="background:url(/templates/intranet/images/car.png); background-position:50%; background-size:auto 70%; background-repeat:no-repeat;width:100%; height:100%;position:absolute;"></div>
1 个解决方案
#1
1
Try this:
尝试这个:
<div style="background:url(/templates/intranet/images/car.png); background-position:50% 50%; background-size:auto 70%; background-repeat:no-repeat;width:100%; height:100%;position:absolute;"></div>
you have to add "background-position:50% 50%;" to write right css.
你必须添加“background-position:50%50%;”写正确的CSS。
#1
1
Try this:
尝试这个:
<div style="background:url(/templates/intranet/images/car.png); background-position:50% 50%; background-size:auto 70%; background-repeat:no-repeat;width:100%; height:100%;position:absolute;"></div>
you have to add "background-position:50% 50%;" to write right css.
你必须添加“background-position:50%50%;”写正确的CSS。