0
我試圖創建兩個divs
被定位爲fixed
,並設置left
和bottom
值如何保持2個固定div的相同位置?
<div id='div1'>test1</div>
<div id='div2'>test2</div>
我想帖的div對中心一字排開
_________________________________________
____ ____
|____| |____|
_________________________________________
我的CSS是如下
div#div1{
position: fixed;
display: block;
bottom: 48px;
left: 35%;
width: 200px;
height: 300px;
background-color:grey;
background-repeat: repeat-x;
text-align: center;
z-index: 500;
}
div#div2{
position: fixed;
display: block;
bottom: 48px;
left: 55%;
width: 200px;
height: 300px;
background-color:grey;
background-repeat: repeat-x;
text-align: center;
z-index: 500;
}
我也需要這些是fixed
位置bec我希望他們保持在同一位置,即使用戶滾動。
我的問題是,如果我改變寬度或改變到不同的屏幕,我不能保持從left
到div
的相同距離。
所以它可以像
___________________________________
____ ____
|____| |____|
___________________________________
如果我有一個小屏幕。
任何人都可以幫助我解決這個問題嗎?非常感謝!