我有一个像通知容器一样下降的容器,我想在绝对定位的div内并排放置两个酒吧。我不想必须定义宽度,因为每个div里面都需要调整宽度(因为是否存在滚动条)两个div/uls并排放置在绝对定位的div内
问题很奇怪,当.notification-wrapper具有绝对或相对定位.left和.right divs不会并排排列,但是当我从.notification包装器中删除绝对/相对...(我确实需要relative/absolute来应用于notification.wrapper)
以下是我的:
<span class="notification-wrapper">
<div class="notification-container">
<div class="left">LEFT</div>
<div class="right">RIGHT</div>
</div>
</span>
.notification-wrapper {
height: 32px;
width: 25px;
margin-right: -12px;
margin-left: -12px;
padding: 0px;
font-size: 0px;
position: absolute;
left: 50%;
top: 15px;
right: 50%;
}
.notification-wrapper .notification-container {
font-size: 12px;
background-color: #FFF;
height: 100px;
position: absolute;
top: 25px;
}
.notification-container .left {
vertical-align: text-top;
display: inline-block;
background-color: #63F;
width: 50px;
}
.notification-container .right {
vertical-align: text-top;
display: inline-block;
background-color: #FFC;
width: 120px;
}
你能发布的CSS,你有没有试过? – Jacob 2012-01-05 04:06:29
那么,我现在所拥有的只是右栏和左栏显示:inline-block;垂直对齐:文本顶部; – 2012-01-05 04:08:41
赞[this](http://jsfiddle.net/LyLGX/)? – 2012-01-05 04:10:45