IE8 的 CSS 问题 - 标题中的 2 个 div 之间出现奇怪的空格

发布于 2024-10-07 02:28:15 字数 366 浏览 0 评论 0原文

您可以在以下位置查看该问题:

http://www.caterinaligato.com/

我们无法重现该问题在 IE7 或任何 Firefox 版本上。在 IE8 上使用 DeveloperTool 显示填充位于

内,但是,我们尝试了 #bannerArea * { padding:0;保证金:0;显示:块; } 但这并没有帮助。

请注意,“兼容性视图”已关闭。

如果有人有任何建议那就太好了!

You can view the issue on:

http://www.caterinaligato.com/

We can't reproduce the issue on IE7 or any of the Firefox versions. Using the DeveloperTool on IE8 its showing that the padding is inside the <div id="bannerArea">, however, we have tried #bannerArea * { padding:0; margin:0; display:block; } and that hasn't helped.

Please note that the 'Compatibility View' is off.

If anyone has any advise that would be great!

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

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

发布评论

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

评论(3

涫野音 2024-10-14 02:28:15

首先将 overflow:hidden; 添加到您的 BannerArea 类中。我也不相信明星黑客一定是最好的选择。我建议删除它,直到证明您绝对需要它。

最后,确保您的 标记的内容全部在一行上。当锚标记在标记中存在换行符时,IE 历史上在正确布局方面存在一定程度的困难,在不应该有的地方显示空白。

您的标记行:

<div id="bannerArea"><span class="bannerContainer first"><a href="#" class='banner-95 bannerImage' title='' rel='nofollow'><img src="/media/pics/site/imagecache/683C6A596432B154340F913300D76915.jpg" width="958" height="346" alt=''/></a> </span></div>

...将标记分成三行,这可能会导致该问题。

Start by adding overflow: hidden; to your BannerArea class. I'm not convinced that the star hack is necessarily the best option either. I would suggest removing that until it's proven that you absolutely need it.

Finally, make sure your <a> tag has its content all on one line. IE has historically had a degree of difficulty with the correct layout when anchor tags have line-breaks in the markup, displaying whitespace where there shouldn't be any.

Your line of markup:

<div id="bannerArea"><span class="bannerContainer first"><a href="#" class='banner-95 bannerImage' title='' rel='nofollow'><img src="/media/pics/site/imagecache/683C6A596432B154340F913300D76915.jpg" width="958" height="346" alt=''/></a> </span></div>

...splits the tag across three lines, which may be contributing to the issue.

时光匆匆的小流年 2024-10-14 02:28:15

在“bannerArea”中使用float:left会减少IE8中的空白,但位置会向右移动,需要重置位置。

use float:left for "bannerArea" it will reduce the white space in IE8, But the position will move right, need to reset the position.

彼岸花ソ最美的依靠 2024-10-14 02:28:15

我很确定这是由于您的下拉菜单而发生的。如果您将溢出:隐藏添加到“bannerArea”div,那么空白就会消失,但位置会被破坏。当添加溢出:隐藏到“nv”div时,图像回到原来的位置。所以你必须注意下拉菜单。也许你可以使用 scrip 下拉菜单而不是纯 css?

I'm pretty sure this is happening because of your drop-down menu. If you add overflow:hidden to you "bannerArea" div, then the white space vanishes, but the placement is ruined. When added overflow:hidden to "nv" div, the image came back to it's place. So you have take care of the drop-down menu. Perhaps you can use scrip drop-down instead of pure css?

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