简体   繁体   English

绝对定位元素的子元素中的精灵在IE7中消失

[英]Sprites inside the child of an absolute positioned element disappear in IE7

I'm new at this so bear with me. 我对此很陌生,请耐心等待。 I have an absolute positioned box inside a relative container and inside that box I've two other divs, one for posts and one for sprites. 我在相对容器中有一个绝对定位的框,在该框内还有另外两个div,一个用于发布,另一个用于精灵。 The sprites completely disappear in IE7 along with the top (and only the top) border on the "posts." 这些精灵与IE 7的顶部(也只有顶部)边框一起完全消失了。 This is basically what it looks like. 这基本上就是它的样子。

 <div id="wrapper">
  <div id="content">
    <div id="left"></div>
    <div id="right">
    <div id="icon">
        <a href="#" class="icon" id="email"></a>
    <a href="#" class="icon" id="twitter"></a>
    <a href="#" class="icon" id="rss"></a>
    </div><!--icon-->  
    <div id="posts">
     <div class="posts_border"></div>
     <!--a bunch of other stuff-->
     <div class="posts_border"></div>
    </div>
    </div><!--right-->
  </div><!--content-->
</div>

#wrapper{width:900px;margin-top:111px;margin-left:-450px;position:relative;left:50%;}
#content{background-color:#F6EFC9; position:relative; width:900px;height:965px;}
#left{padding-right:10px;width:550px;}
#right{position:absolute;top:0;right:20px;width:300px;}
#icon{margin:10px 0 0 -8px;top:0;right:20px;}
#icon .icon{margin-left:40px;width:50px;height:50px;float:left;}
#email{background:url("../images/icon-sprite.png")left 0 top -110px;}
#twitter{background:url("../images/icon-sprite.png") left 0 top -55px;}
#rss{background:url("../images/icon-sprite.png") left 0 top 3px;}
#posts{background:#E3C66E; margin-top:10px;position:absolute;top:66px;}
#right .posts_border{height:20px;background-color:#442503;}

http://jsfiddle.net/isherwood/aJwKJ/ http://jsfiddle.net/isherwood/aJwKJ/

This seems to work in every browser aside from IE7. 除了IE7,这似乎在所有浏览器中都有效。

I had to do this in IE10 by changing my Browser/Document mode to IE7/IE7 on a local document. 我必须在IE10中通过将本地文档上的浏览器/文档模式更改为IE7 / IE7来执行此操作。 I had problems with jsfiddle loading in that browser/doc mode. 我在以浏览器/文档模式加载jsfiddle时遇到问题。 I only changed the following sections 我只更改了以下部分

#email {
    background-image: url("http://placehold.it/32x32");
    background-position: 0 -110px;
}
#twitter {
    background:url("http://placehold.it/32x32");
    background-position:0,-55px;
}
#rss {
    background:url("http://placehold.it/32x32");
    background-position:0,3px;
}

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

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