1
我試圖讓我的bootstrap旋轉木馬在固定位置作爲背景。在我的實際代碼中,我已經將它的寬度和高度填充到了屏幕上,但它只保留在一個地方。我在包含旋轉木馬的部分上添加了'position:fixed'位置,這樣它就會浮在前面,我將把它索引到其餘內容的後面,但它完全消失了嗎?使引導轉盤的位置固定?
我已經在這個簡單的例子複製的問題:
HTML
<div class="fill bg-green">
<div>content section (scroll down)</div>
</div>
<div class="fill bg-white">
<div>content section (further x)</div>
</div>
<div class="fill bg-green fixed-section"> <!-- fixed section declared here -->
<-- carousel code -->
</div>
<div class="fill bg-white">
<div>content section</div>
</div>
CSS:
.fill {
width: 100%;
height: 100%;
position: relative;
}
.fixed-section {
position: fixed; /* controls fixed carousel positioning here */
}
驚人。我一直在盯着牆壁砸我的頭,想知道爲什麼這樣做不起作用,因爲我可以使它在所有其他部分上工作,並且錯過了顯而易見的哈哈哈!非常感謝! –