簡體   English   中英

如何將div從特定位置延伸到頁面底部?

[英]How to stretch a div from certain position to the bottom of the page?

我正在嘗試將div從其當前位置延伸到頁面末尾。 我該怎么辦? 這是我的代碼:

<div style="text-align:center; font-weight:bold; font-size:small; background-color:Silver; position:absolute; width:100%">Copyright © Aradmey<br /><%= GetDomain() %></div>

div不在頁面頂部,只是頁腳,而我無法使其正常工作。

當前,頁面看起來像這樣 我希望它看起來像這樣 ,但是如果沒有將其拉伸到最底端以使其可滾動。 我希望它只有在尚未觸及底部時才能伸展。

我會建議。

 html,body{height: 100%;} .stretch{ height: 100%; display: table; width: 100%; } .stretch .left{ display: table-cell; width: 40%; background: #333; } .stretch .right{ display: table-cell; width: 60%; background: #ccc; } 
 <div class="stretch"> <div class="left"></div> <div class="right"></div> </div> 

將來html和css應該在這樣的不同類中: Fiddle

使用您的代碼,您只需添加“ bottom:0;” 根據您的風格: 打印

CSS
#footer{
    text-align:center;
    font-weight:bold;
    font-size:small; 
    background-color:Silver;
    position:absolute;
    width:100%;
    bottom: 0;
}

HTML
<div id="footer">Copyright © Aradmey<br /><%= GetDomain() %></div>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM