简体   繁体   English

IE6浮动<img>

[英]IE6 float <img>

Sometimes in a floated div. 有时在浮动的div。 IE6 does not display tags, however it does space the image correctly, and when you right click the image it gives correct details like size and file size. IE6不显示标签,但它确实正确地分隔图像,当您右键单击图像时,它会提供正确的大小和文件大小等详细信息。 It just does not display the image: 它只是不显示图像:

<div style="float:left">
    <img src="one.gif" />
</div>
<div style="float:left">
    <img src="two.gif" />
</div>

These images are not displayed in IE6 but are displayed in Firefox/Safari/etc... What is the workaround? 这些图像不会显示在IE6中,而是显示在Firefox / Safari / etc中......解决方法是什么?

It's called the "Peekaboo" bug. 它被称为“Peekaboo”错误。 For more information see: 有关更多信息,请参阅

http://www.positioniseverything.net/explorer/peekaboo.html http://www.positioniseverything.net/explorer/peekaboo.html

The preferred method to fix this is to set the hasLayout property on the container to true 解决此问题的首选方法是将容器上的hasLayout属性设置为true

One workaround is to use: 一种解决方法是使用:

position: relative;
float: left;

Try also floating the images, that will work! 尝试浮动图像,这将工作!

div img {
   float:left;
}

By default images are display:inline; 默认情况下,图像display:inline; when they are in a floated div the div won't surround them. 当他们处于浮动的div中时,div不会包围他们。 I believe this is the cause of the display bug. 我相信这是显示错误的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM