簡體   English   中英

頁腳div沒有保持在底部

[英]Footer div not keeping itself at bottom

紅色頁腳在中間上升。 如何讓它保持在底部? clear: bothoverflow: hidden

我已經嘗試了很多東西,是不是我做錯了什么?

演示

代碼太大,無法粘貼在這里(30000 個字符限制)。 請把工作小提琴發給我。

更新:現在可以使用了。

#footer {
  position: relative;
  height: 274px
  bottom: 0;
  margin-top: 274px;
}

你有

#footer {
    margin:-274px 0 0;
}

這使它具有負的上邊距並向上移動頁腳。 嘗試刪除該行。 雖然您可能還需要調整頁面的內容。 您應該在內容上使用 clearfix,這樣它就不會落后於頁腳。

試試這個 :

#footer {
    position:fixed;
    bottom:0;
}
  1. clear: bothposition: absolute元素無效,因為它們超出了正常流程。
  2. 設置一個position: absolute; bottom: 0; position: absolute; bottom: 0; div.gallery元素上的div.gallery ,它將位於其容器的底部。

但這對您來說還不夠,您還應該將<div class="gallery">移出其容器 div。

暫無
暫無

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

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