由于某种原因,我在 IE 7 和 IE8 中显示背景图像时遇到问题。在 IE9 和更现代的浏览器中,它可以工作并输出以下内容:
(CSS 在登录周围生成灰色边框元素)
但是在 IE7 和 IE8 中我得到的只是以下内容:
我不记得我交叉兼容的其他网站有过这个问题,但现在我再次尝试避免使用图像来节省页面加载时间。
我的CSS如下:
#contentright .panel {
background-image: url("/incl/images/bg_panel200.gif");
background-repeat: no-repeat;
}
#contentright .panelbottom {
background-image: url("/incl/images/bg_panelbottom200.gif");
background-position: center top;
background-repeat: no-repeat;
}
我快速进行了 Google 搜索,之前的一些 Stack Overflow 答案建议将 CSS 修改为以下格式:
background: url('/incl/images/bg_panelbottom200.gif') no-repeat center top;
但是这似乎也不起作用。
提前致谢。
最佳答案
尝试对元素使用display:block
并设置宽度
和高度
也使用border:none;背景颜色:透明
关于css - 背景图像 css 在 IE7 和 8 中无法显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15295928/