html - 绝对定位元素的子元素内的 Sprite 在 IE7 中消失

标签 html css internet-explorer xhtml

我是新手,所以请多多包涵。我在相对容器内有一个绝对定位的框,在该框内我有另外两个 div,一个用于帖子,一个用于 Sprite 。 Sprite 在 IE7 中完全消失,连同“帖子”上的顶部(并且只有顶部)边框。这基本上就是它的样子。

 <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/

这似乎适用于除 IE7 之外的所有浏览器。

最佳答案

我必须在 IE10 中通过将本地文档上的浏览器/文档模式更改为 IE7/IE7 来执行此操作。我在该浏览器/文档模式下加载 jsfiddle 时遇到问题。我只更改了以下部分

#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;
}

关于html - 绝对定位元素的子元素内的 Sprite 在 IE7 中消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18986747/

相关文章:

html - CSS+HTML : tds are overlapping

jquery - 在不破坏图像的情况下, slider 中所有图像的高度相同

html - 如何修复在 Edge 上运行良好但在 IE 上运行不正常的 CSS

html - Internet Explorer 中的溢出表错误

css - Angular-Strap 1.2+模态滚动条

css - 绝对内部相对溢出即

html - 新词典网站的 SEO 问题,谷歌没有索引内容

javascript - 如何防止表单被提交?

javascript onchange 选择并更新输入或文本对象

html - 谷歌浏览器中的压缩图像