我在 IE9 中遇到了一个跨度(span.share
)的问题,我试图将它放在一个跨度内的所有这些float:right
div 旁边。float:left
jsfiddle(记得在IE中查看):http: //jsfiddle.net/MgW6R/2/
这是它在 IE9 中的样子:
这就是它的外观(并且在其他浏览器中看起来像):
html
<div class="contentWrapper">
<div class="content">
<span class="contentItem">
<a href="javascript: void(0);">
<img src="http://www.example.com/image1.jpg">
</a>
<div class="detailsWrapper">
<div class="name-date">
<span class="date">Jul 04: </span>
<span class="userName">Christie</span>
</div>
<span class="share"></span>
<div class="clear"></div>
<div class="caption">Watching the fireworks in NY without the crowds, heat and concussion via tv #cahs</div>
</div>
</span>
<span class="contentItem">
...
</span>
</div>
</div>
css
.contentWrapper {
overflow: hidden;
position: relative;
}
.content {
margin-left: 256px;
padding-top: 14px;
position: relative;
white-space: nowrap;
}
.contentItem {
display: inline-block !important;
margin: 0 14px 0 0;
vertical-align: top;
}
.contentItem a {
display: block;
}
.contentItem img {
height: 450px;
}
.contentItem .detailsWrapper {
color: #E3E3E3;
position: relative;
}
.contentItem .detailsWrapper .name-date {
float: left;
padding: 5px 0 0;
}
.contentItem .detailsWrapper .share {
background: url("http://www.connectionsacademy.com/_images/teenWebsite/share-btn-sprite.png") no-repeat scroll 0 0 transparent;
cursor: pointer;
float: right;
height: 23px;
width: 91px;
}
.clear { clear: both; }
.contentItem .detailsWrapper .caption {
margin-top: 10px;
white-space: normal;
width: 450px;
word-wrap: break-word;
}
注意:
我最初有span.share
position:absolute
,但我不得不更改它,因为它会导致页面上的其他元素出现问题。