gpt4 book ai didi

html - 背景图像在 AngularJS 的 IE8 中不起作用

转载 作者:行者123 更新时间:2023-11-28 13:16:13 24 4
gpt4 key购买 nike

我有这个带背景的简单 HTML DIV,其中的图像未显示在 IE8 中。它适用于所有其他浏览器。

顺便说一句,我正在使用 AngularJS。

div 是:-

<div class="slide" 
style="background-image:url(content/1.jpg);
background-repeat:no-repeat; min-width:955px;
min-height:420px; display:block;">
</div>

谢谢。

编辑

我刚刚检查了一下,在 IE 中,背景一开始就没有。

标签在 IE 中显示为:-

<div class="slide" style="min-width: 955px; min-height: 420px; display: block; background-repeat: no-repeat;">

奇怪。

最佳答案

我不是 Internet Explorer 的专家,但我知道过去的浏览器在规则方面不如今天更新的浏览器灵活。从技术上讲,background-image 应该用引号包裹图像。所以尝试添加这些,看看它是否有效。

background-image:url("content/1.jpg");

作为旁注,您可以将 background-imagebackground-repeat 压缩到一个规则中。它看起来像这样。

background: url("content/1.jpg") no-repeat;

为了防止无法正常工作,您应该始终为无法加载图像的情况添加背景色。

background-color: white;
/* Or */
background: white url("content/1.jpg") no-repeat;

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

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com