顯示廣告
隱藏 ✕
看板 Farland
作者 Farland (法蘭多)
標題 [CSS] float後高度撐不開的DIV
時間 2013年04月02日 Tue. AM 09:01:33


#topDiv
{
    margin-top: 5px;
    border-top: 1px solid gray;
    margin-bottom: 3px;
}
/*
加這個就可以撐開了
原理是利用:after在末端加上一個"."並隱藏起來
個人覺得這是比<div style="clear: both;">&nbsp;</div>更好的做法
*/

    #topDiv:after
    {
      content: ".";
      display: block;
      height: 0;
      clear: both;
      visibility: hidden;
    }


#leftDiv
{
    padding-top: 5px;
    float: left;
    width: 69%;
}

#rightDiv
{
    position: relative;
    padding: 3px;
    float: right;
    width: 30%;
    overflow: auto;
    background: #DAECF4;
    height: 100%;
}

#rightBottomDiv
{
    position: absolute;
    padding: 3px;
    min-height: 150px;
    width: 100%;
    overflow: auto;
    background: #f00;
}

--
※ 作者: Farland 時間: 2013-04-02 09:01:33
※ 編輯: Farland 時間: 2013-04-02 09:06:24
※ 看板: Farland 文章推薦值: 0 目前人氣: 0 累積人氣: 1159 
r)回覆 e)編輯 d)刪除 M)收藏 ^x)轉錄 同主題: =)首篇 [)上篇 ])下篇