IE7 img - a href,寻找解决方法

发布于 2025-01-08 11:48:01 字数 440 浏览 0 评论 0原文

我遇到了这个问题,这是 IE7 中的一个恼人的错误。

在此处输入图像描述

img 周围的 href 声明“Boston Whaler”上方左侧换行符。

我无法找到解决方法。也许你们中的一些人这样做?

img {
    float:left;
    margin-right:5px;
    margin-bottom:5px;
    display:block;
}

我在这里重现了这个问题: http://bouwknecht.nl/ie7bug

I have this issue occurring, its an annoying bug in IE7.

enter image description here

The a href around the img claims a newline on the left right above 'Boston Whaler'.

I don't manage to find a workaround for this. Maybe some of you do?

img {
    float:left;
    margin-right:5px;
    margin-bottom:5px;
    display:block;
}

I reproduced the problem over here: http://bouwknecht.nl/ie7bug

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

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

发布评论

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

评论(2

高冷爸爸 2025-01-15 11:48:01

There are a lot of things wrong with your CSS rules found here - bouwknecht.nl/boten - inside your list elements <li> you have floating content ( the <img> tag ) which shouldn't be floating, I assume means you want to float your image to the left, you need to float the <a> tag parent of the <img> and give it the same margins as inside the <img> needless to say remove any styling from that <img> tag, also the div.price has a big bottom margin, is there a reason for this? you need to let the <li> element know you have floating elements inside and that the height needs to be recalculated maybe a clearfix type of solution works here, meanwhile overflow: hidden; works on the <li> element but going back to your div.price you will need to fix the margins since you are working with negatives, I tried fixing this with margin: 0; and it worked just fine, this might not be the "Answer for IE7" but once you fix your rules you will make sure every browser does it's best to conform to the spec, if you write bad code then browsers try to be smart and fix it for you using each its unique way thus working in some

太傻旳人生 2025-01-15 11:48:01

在 IE7 中,如果您还将 float:left 应用于 h3 元素,它将与顶部对齐。在这种情况下,请确保将 clear:both 应用于每个 li 元素。

In IE7, if you also apply float:left to the h3 element, it will align to the top. In that case, make sure that you apply clear:both to each li element.

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