2011-01-24 136 views
1

試圖用相對/絕對定位,實現這一點,浮動CSS頂部和底部對齊

    Col1       Col2 
------------------------------------------------------------ 
- H1 Content aligned to top   - Some Content  - 
-          -     - 
-          -     - 
-          -     - 
-          -     - 
-          -     - 
-          -     - 
- Some other content aligned to bot -     - 
------------------------------------------------------------ 

col2的驅動Col1中

的高度

我要麼沒有得到高度COL1 COL2或結束重疊Col1當我使用COL1中的項目絕對pos

任何幫助嗎?

感謝

+0

向我們展示您的代碼:) – Sotiris 2011-01-24 17:41:53

回答

0

最好的解決方案我已經是一個固定高度的容器:

<div id="news"> 
    <div class="news-panel" id="left-news"> 
    <h2>Side Header</h2> 
    </div> 
    <div id="footer-news"> 
    <h2>Side Footer</h2> 
    </div> 
    <div class="news-panel" id="right-news"> 
    Main Content 
    </div> 
</div> 

div#news { margin: 0px auto; position: relative; width: 895px; height: 208px; border: 1px solid gray; } 
div#news div.news-panel { position: absolute; top: 0; } 
div#news div#footer-news { position: absolute; bottom: 0; } 
div#news div#left-news { left: 0; margin-right: 60px; width: 390px; border: 1px solid red; } 
div#news div#right-news { width: 437px; right: 0px; } 

樣的作品,雖然我希望不要指定高度 - 這是工作(見「發生了什麼「部分):AgileApps