仅 IE 中的链接图像上不需要的填充
我希望有人能提供帮助。在我的容器 DIV 中,我有 3 个图像,我需要将它们并排坐在一排。这确实是所有其他浏览器的情况,除了像往常一样烦人的 IE6、IE7 和 IE8(唉)。
每个图像都包含在标签中,如下所示:-
<div id="images">
<a href="images/image01.jpg" rel="milkbox[group]" title="my image details01"><img src="images/image01b.jpg" width="98" height="92" alt="my image details01" class="img01"></a>
<a href="images/image02.jpg" rel="milkbox[group]" title="my image details02"><img src="images/image02b.jpg" width="98" height="92" alt="my image details02" class="img02"></a>
<a href="images/image03.jpg" rel="milkbox[group]" title="my image details03"><img src="images/image03b.jpg" width="99" height="92" alt="my image details03" class="img03"></a>
</div><!--end of images-->
我的 CSS 如下:-
/* Global reset */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
vertical-align: baseline;
}
a img, :link img, :visited img {
border: 0;
display:block;
}
img{
display:block;
}
/* End Global reset */
#images{
width:295px;
clear:both;
border:none;
margin-top:30px;
}
#images a:link{
text-decoration:none;
border:none;
}
#images a:visited{
text-decoration:none;
border:none;
}
#images a:hover{
text-decoration:none;
border:none;
}
img.img01,img.img02 {
width:98px;
float:left;
}
img.img03{
width:99px;
float:right;
}
无论我做什么,我似乎都无法纠正 IE 中的显示。 IE 在每个图像的左侧和右侧添加额外的填充,结果是 2 个图像仅显示在该行内,而第 3 个图像出现在其下方(向右浮动)。
我尝试删除所有空白(我在其他地方遇到的建议),但这没有帮助。我也尝试过负利润,但我不想在不了解实际情况的情况下走这条路。
谁能告诉我这里到底发生了什么以及我该如何解决? - 这让我发疯!
非常感谢。
I hope someone can help. Within my container DIV I have 3 images which I require to sit side by side in one row. This is indeed the case in every other browser except, annoyingly, as usual, in IE6, IE7 and IE8 (groan).
Each of the images is wrapped in an tag as follows:-
<div id="images">
<a href="images/image01.jpg" rel="milkbox[group]" title="my image details01"><img src="images/image01b.jpg" width="98" height="92" alt="my image details01" class="img01"></a>
<a href="images/image02.jpg" rel="milkbox[group]" title="my image details02"><img src="images/image02b.jpg" width="98" height="92" alt="my image details02" class="img02"></a>
<a href="images/image03.jpg" rel="milkbox[group]" title="my image details03"><img src="images/image03b.jpg" width="99" height="92" alt="my image details03" class="img03"></a>
</div><!--end of images-->
My CSS is as follows:-
/* Global reset */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
vertical-align: baseline;
}
a img, :link img, :visited img {
border: 0;
display:block;
}
img{
display:block;
}
/* End Global reset */
#images{
width:295px;
clear:both;
border:none;
margin-top:30px;
}
#images a:link{
text-decoration:none;
border:none;
}
#images a:visited{
text-decoration:none;
border:none;
}
#images a:hover{
text-decoration:none;
border:none;
}
img.img01,img.img02 {
width:98px;
float:left;
}
img.img03{
width:99px;
float:right;
}
No matter what I do I can't seem to correct the display in IE. IE is adding additional padding to the left and right of each image, and the result is that 2 images only display within the row and the the 3rd image appears below it (floated right).
I have tried removing all white space (a suggestion i came across elsewhere) but that hasn't helped. I've also played around with negative margins but I'd prefer not to go down that route without understanding what's actually occurring.
Can anyone please shed some light on what's actually going on here and how I can resolve ? - it's drving me nuts !
Many thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
IE 存在空格问题...尝试删除标签之间的间距并将它们放在一行上。
There is a whitespace issue with IE...try removing the spacing between your tags and put them on a single line.
你得看看IE是如何计算宽度的。这 3 个图像的总宽度为 295,您的 div 的总宽度为 295。div 的 295 宽度是从 div 的外部测量的,不幸的是 div 的内容区域小于 295。作为实验增加div 的宽度并查看图像是否正常显示。
此是描述它的一页。只需在谷歌中搜索 IE Box Model 即可。
You have to look at how IE calculates width. The 3 images have a total width of 295 and your div has a total width of 295. That 295 width of the div is measured from the outside of the div and unfortunately the content area of the div is less than 295. As an experiment increase the width of the div and see if the images display properly.
This is one page that describes it. Just search for IE Box Model in google.