该代码可在我尝试过的所有其他浏览器中使用,但IE8除外。

IE8似乎忽略了z-index-弹出式窗口变成了弹出式窗口。

它在正确的位置,仅在缩略图下方呈现。

任何人?

谢谢!

HTML:

<a class="thumbnail" href="#thumb">
    <img src="comic_a3_thumb.jpg" height="300" width="212" border="0"
         style="float:right; margin-top:10px;margin-bottom:10px;"
         alt="description" />
    <span>
        <img src="/images/comic_a3_popup.jpg" />
    </span>
</a>


CSS:

.thumbnail{
    position: relative;
    z-index: 0;
}

.thumbnail:hover{
    background-color: transparent;
    z-index: 50;
}

.thumbnail span{ /*CSS for enlarged image*/
    position: absolute;
    background-color: lightyellow;
    padding: 5px;
    left: 0px;
    border: 1px dashed gray;
    visibility: hidden;
    color: black;
    text-decoration: none;
}

.thumbnail span img{ /*CSS for enlarged image*/
    border-width: 0;
    padding: 2px;
}

.thumbnail:hover span{ /*CSS for enlarged image on hover*/
    visibility: visible;
    top: -140px; /*position where enlarged image should offset horizontally */
    left: -500px;
}

最佳答案

简单的答案是将大于z-index值的.thumbnail:hover值添加到span的悬停状态。

.thumbnail:hover span{ /*CSS for enlarged image on hover*/
    visibility: visible;
    top: -140px; /*position where enlarged image should offset horizontally */
    left: -500px;
    z-index: 51;
}

关于internet-explorer-8 - IE8中的Z索引损坏了吗?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/1290191/

10-15 18:37