在IE 8中未显示的PNG背景图像<用html5?

编程入门 行业动态 更新时间:2024-10-24 20:13:38
本文介绍了在IE 8中未显示的PNG背景图像<用html5?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有以下HTML代码:

I have the following html code:

<section class="first-content-top"> <img src="images/img-diner.png" /> <h1>Menu</h1> </section> <section class="first-content-middle"> <article class="menu"> </article> </section> <section class="first-content-bottom"></section>

使用以下类型的css:

With the following type of css:

.first-content-middle { background: url("images/bg-black.png") repeat; margin: 0 0 0 37px; padding: 0 20px; width: 595px; }

但在IE8中,我仍然看不到背景图像,就像我看到的那样在IE9或Firefox中:

But in IE8 i still can't see a background image, like i see in IE9 or firefox:

这是IE8的图片:

这里是firefox的图片,它应该如何:

我尝试了以下解决方案:

I tried the follwing solutions:

为了防止出现此问题,我将以下html5shiv代码添加到页面的头部:

To prevent the problem i added the following html5shiv code to the head of the page:

<!--[if IE]> <script src="html5shiv.googlecode/svn/trunk/html5.js"></script> <![endif]-->

在firebug中我检查以确保section元素具有显示:block; 属性设置。

And in firebug i checked to make sure that the section element has the display:block; property set.

编辑:将 height css属性添加到部分修复了背景问题。但截面高度是可变的。那我该怎么办?

Adding the height css property to the section fixes the background problem. But the section height is variable. So how do i fix that?

有什么建议吗?

推荐答案

你的png背景图片需要至少4x4px。

Your png background image needs to be at least 4x4px.

更多推荐

在IE 8中未显示的PNG背景图像&lt;用html5?

本文发布于:2023-07-27 02:53:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1219930.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:中未   图像   背景   PNG   lt

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!