我想要两个div彼此相邻,一个div滚动,另一个静态。一个例子是AirBnb's Map。两个divs一个滚动,另一个是静态的
我很难让右侧栏浮动到左侧栏的右侧。我怎么能让左边的酒吧总占用60%的空间,而右边的酒吧总是占40%?在下面的代码中,从不显示右侧栏。
这里是fiddle。
#container {
height: 100px;
position: absolute;
top: 62px;
bottom: 0;
left: 0;
right: 0;
}
#left-bar {
background-color: red;
position: fixed;
top: 0;
left: 0;
bottom: 0;
width: 60%;
overflow-y: scroll;
}
#right-bar {
position: relative;
background-color: green;
display: block;
position: fixed;
right: 0;
left: auto;
bottom: 0;
}
<div id="container">
<div id="left-bar"></div>
<div id="right-bar"></div>
</div>
'高度:100%'应用'顶部取代:0;'用于与所述左杆的一致性。 –