2015-03-02 350 views
0

我想構建一個頁面,其中頁面中間的某個DIV元素是可水平滾動的(大寬度+ overflow-x: scroll)。滾動條將出現在這個DIV的底部。水平滾動+滾動條

是否可以在頁面最底部顯示一個滾動條(所以不在div底部),它只滾動頁面中間那個可滾動的DIV中的內容?

我問這個問題,因爲我想將內容放置在可滾動的DIV下面,我希望用戶能夠通過位於此內容下的滾動條滾動水平線DIV

<body> 
<div id="wrap"> 

    <div class="slider"> 
     # Slider content here 
    </div> 

    <ul class="job_listings scrollable"> 
     <li>job 1</li> 
     <li>job 2</li> 
     <li>job 3</li> 
     <li>job 4</li> 
    </ul> 

    <div class="about us"> 
     # About us content here 
    </div> 

    ** here I want the scrollbar of the ul job_listings to appear, at the very bottom of the page ** 

</div> 
</body> 
+0

能否請您分享的HTML,以及你想什麼呢? – 2015-03-02 12:56:53

+0

更多信息請 – Lafontein 2015-03-02 13:07:13

+0

我添加了我的html代碼示例 – 2015-03-02 13:11:00

回答

1

您可以通過添加position: fixed;到非滾動內容來實現這一目標。

.slider { 
    position: fixed; 
    top: 0; // Assuming you want this to be on top 
} 
.about_us { 
    position: fixed; 
    bottom: 0; // Assuming you want this to be on the bottom 
} 

JSFiddle demo

+0

謝謝,我認爲這是佈置頁面的唯一可能的解決方案。 – 2015-03-02 15:29:57

0

使用padding-bottom:180px像我一樣在這裏http://jsfiddle.net/v6ohjw32/ 和刪除border:2px solid green;消除邊界

+0

我相信他希望滾動條位於頁面最底部和全角,就像本地瀏覽器滾動條一樣。 – 2015-03-02 14:02:15

+0

這是真的,它需要在最底部 – 2015-03-02 14:10:43

+0

您可以根據您的需要增加填充底部大小 – YourFriend 2015-03-02 14:12:10