开发者

IE z-index and position problem

I have IE 8 and IE 7 z-index, position and other problems. I've made an example of these problems at http://jsfiddle.net/KeEPF/. If you look at it through Chrome, Mozilla or another browser, you would notice the big image has links on top of it (with link #imagemap2). On IE8 and IE7 this image is always on top and you can not click the links.

How can I fix this problem?

Here is the code:

<div id="splashbar"> 
    <div id="left_content_text"> 
        <img src="#" alt="facebook" /> 
        <h2> <a href="" style="color:#fff; text-decoration:none;">test</a></h2> 
        Lorem ipsum dolor sit amet, con tetur adipiscing elit. Etiam tincidu molestie justo, vitae dignissim me scelerisque vel. Proin vitae nibh arcu vulpu tate vehicula.<br/> 
    </div> 
    <div id="splashimages"> 
        <a href="#full_header_link" class="full_header_link"> 
            <img width="738" height="191" src="tet" class="attachment-post-thumbnail wp-post-image" alt="header_forside" title="header_forside" />                                            </a> 
        <a href="#imagemap1" style="width:100px;height:100px;left:0px; top:10px" class="imagemap_header_link"> </a> 
        <a href="#imagemap2" style="width:100px;height:100px;right:0px; top:10px" class="imagemap_header_link"开发者_Python百科></a> 
    </div> 
    <div class="clear"> 
    </div> 
</div> 
#splashbar {
    position: relative;
    zoom: 1;
    z-index: 2;
}
#splashimages {
    position: relative;
    top: 0;
    right: 0;
    z-index: 2;
    zoom: 1;
}
#splashimages img {
    z-index: -5;
    position: absolute;
    right: 0;
    top: 0;
    visibility: visible;
    display: block;
    height: 173px;
    zoom: 1;
}
#splashimages .imagemap_header_link {
    position: absolute;
    display: block;
    z-index: 990;
    visibility: visible;
    zoom: 1;
}


it can be fixed with a bit of a cheat..

IE doesn't like the fact that there is no background on your 2 "imagemap" links, though I presume you want them transparent as that's the idea of the map

this works for me:

#splashimages .imagemap_header_link {
  position: absolute;
  width: 100px;
  height: 100px;
  top: 10px;

  background: #dad; /* any color */
  filter:alpha(opacity=0); /* make it transparent in IE again */
  opacity: 0; /* make it transparent for good browsers */
}

Working Example

added: for the record the working example has removed all unnecessary extra properties, there no need to set zoom: 1; on any of the divs, the absolutely positioned ones already have "hasLayout"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜