我想要兩個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;'用於與所述左杆的一致性。 –