IE8 中的背景图像问题

发布于 2024-10-04 21:39:01 字数 1755 浏览 0 评论 0原文

我已经尝试了各种修复方法,但仍然无法解决 IE8 中这个相当烦人的问题。我有一个容器 Div,其中包含两个子 Div,一个向左浮动,另一个向右浮动。有一个背景图像应用于容器 DIV,并且在 ie6 和 ie7 中按应有的方式呈现,但在 ie8 中它不会出现。我认为问题是应用于两个子元素的顶部填充没有被 ie8 尊重/应用,并且由于背景图像的高度只有 11px,所以两个子元素与父 DIV 齐平,因此背景图像未显示。

这是我的代码和 CSS:

       <div id="bottom">

        <div class="moduletable_footermenu">
     <ul class="menu"><li class="item56"><a href="/~domain/index.php?option=com_content&amp;view=article&amp;id=52&amp;Itemid=56"><span>Class Schedule</span></a></li><li class="item57"><a href="/~domain/index.php?option=com_content&amp;view=section&amp;layout=blog&amp;id=4&amp;Itemid=57"><span>Testimonials</span></a></li><li class="item58"><a href="/~domain/index.php?option=com_content&amp;view=article&amp;id=53&amp;Itemid=58"><span>Contact</span></a></li><li id="current" class="active item59"><a href="/~domain/index.php?option=com_xmap&amp;sitemap=1&amp;Itemid=59"><span>Sitemap</span></a></li></ul>  </div>

   <div class="moduletable">
     Copyright &#169; -2010 sitename   </div>


  </div><!--end of bottom -->

CSS:

div#bottom {
clear:both;
width:1014px;
margin:0px auto; 
background:url(../images/footer-shadow.gif) top no-repeat;
}

div#bottom div.moduletable {
width:400px;
float:left;
font-size:0.9em;
color:#ccc;
padding:15px 0px 15px 0px;
}

div .moduletable_footermenu{
float:right;
padding:15px 30px 15px 0px;
}

它一定是 IE8 特有的东西,可能是一些很小的东西导致了这里的问题 - 谁能发现这个问题吗?无论我如何尝试,我似乎都无法解决它。

感谢您的任何帮助。

提前致谢。

I've tried various fixes but I'm still unable to solve this rather irritating issue in IE8. I have a container Div containing two child Divs, one floated left and the other floated right. There is a background image applied to the container DIV and this renders as it should in ie6 and ie7, however in ie8 it just will not appear. I think the issue is that the top padding applied to both child elements is not being respected/applied by ie8, and since the background image has a height of only 11px, the two child elements are sitting flush up against the parent DIV and therefore the background image is not displaying.

Here's my code and CSS:

       <div id="bottom">

        <div class="moduletable_footermenu">
     <ul class="menu"><li class="item56"><a href="/~domain/index.php?option=com_content&view=article&id=52&Itemid=56"><span>Class Schedule</span></a></li><li class="item57"><a href="/~domain/index.php?option=com_content&view=section&layout=blog&id=4&Itemid=57"><span>Testimonials</span></a></li><li class="item58"><a href="/~domain/index.php?option=com_content&view=article&id=53&Itemid=58"><span>Contact</span></a></li><li id="current" class="active item59"><a href="/~domain/index.php?option=com_xmap&sitemap=1&Itemid=59"><span>Sitemap</span></a></li></ul>  </div>

   <div class="moduletable">
     Copyright © -2010 sitename   </div>


  </div><!--end of bottom -->

CSS:

div#bottom {
clear:both;
width:1014px;
margin:0px auto; 
background:url(../images/footer-shadow.gif) top no-repeat;
}

div#bottom div.moduletable {
width:400px;
float:left;
font-size:0.9em;
color:#ccc;
padding:15px 0px 15px 0px;
}

div .moduletable_footermenu{
float:right;
padding:15px 30px 15px 0px;
}

It must be something specific to IE8 and probably something quite small causing the issue here - can anyone please spot the problem ? I just can't seem to solve it no matter what I try.

Grateful for any help.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鱼忆七猫命九 2024-10-11 21:39:01

您尝试过 Firefox 和 Chrome/Safari 吗?您使用标准 DOCTYPE 吗?它们的行为方式应该与 IE8 相同。

在标准 CSS 中,容器的高度不会调整为浮动框的高度;我希望 IE8 不会显示容器(高度=0px),因为它是一个更兼容标准的浏览器。

如果您正在标准兼容的浏览器中寻找 IE6/7 中的效果,请搜索“clearfix”解决方案。

Have you tried Firefox and Chrome/Safari? Did you use standard DOCTYPE? They should behave the same way as IE8 did.

In standard CSS, container's height will not be adjusted to the height of the floated boxes; I will expect IE8 to not showing the container (height=0px) being the fact it's a more standard-compatible browser.

If you are looking for effects in IE6/7 in a standard-compatible browser, search for 'clearfix' solutions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文