簡體   English   中英

CSS:將div與父div的底部對齊

[英]CSS: Aligning a div to the bottom of a parent div

http://jsfiddle.net/nFrp7/4/

我有一個類似於我創建的jsfiddle的布局。 我想知道如何不管如何(但不使用position: fixed;bottom: 0; )將藍色div放置在底部(紅色div延伸的position: fixed; )。

我怎樣才能做到這一點?

檢查此http://jsfiddle.net/nFrp7/10/

使用wrap div包含所有布局div,並對blue div使用絕對定位

在所有內容周圍放置一個包裝div並應用height:400px; position:relative; 對此。 然后使用position:absolute; bottom:0; right:0; 在藍色的div

嗯...

 .right-main { width: 100px; height: 30px; clear: both; background-color: green; } 

清除左側的div?

由於一切都是浮空的,所以我認為沒有任何定位是不可能的。

好吧,這是... 更新

但是它確實使用定位。

啊...您指的是CSS 100%高度問題 也檢查一下: 100%最小高度CSS布局

嘗試這個,

.right-main {
      width: 100px;
      **height: 400px;**
      background-color: green;
    **position: relative;**
    } 

.bottom-right {
      background-color: blue;
      **position:absolute;**
      **bottom: 0;**
    }

暫無
暫無

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

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