2013-04-27 100 views
14

我正在嘗試使用twitter-bootstrap框架爲我的應用程序設計管理面板,但無法讓我的佈局工作。Twitter Bootstrap - 100%身高

我被這樣的設計靈感:enter image description here
這將是一個兩個欄佈局「側邊欄」和「主要內容」,但我不能得到100%的高度工作。我設法使用此代碼來獲得2欄佈局與100%的寬度:

HTML

<div class="container-fluid"> 
<div class="row-fluid"> 


    <div class="span2 colorize-white"> 
    <!--Sidebar content-->Sidebar 
    </div> 


    <div class="span10 colorize-white"> 
    <!--Body content-->Main 
    </div> 


</div> 
</div> 

CSS

/* Global */ 
html, body { 
    color: #6B787F; 
    padding: 0; 
    height: 100%; 
    background: #11161a; 
    font-family: 'PT Sans' !important; 
} 

.colorize-white { 
    background: #FFFFFF; 
} 

.no-margin { 
    margin: 0; 
} 

我走了一半,但有兩件事情我不能解決。
1)100%高度
2)入門上的第二圖像消除外邊緣的

enter image description here 可以看到,我有瀏覽器邊界和側欄/主要元素,然後在兩者之間餘量之間的餘量。如果我在我粘貼的所有HTML元素中添加無邊距(包括身體標記),我需要擺脫這種情況,但我仍然無法獲得100%的高度,並且仍然無法擺脫瀏覽器邊框和邊欄以及主要內容之間的邊距邊欄和主內容之間的空白區域消失。

+0

很抱歉,但你找得到相同的設計IMG? – Mee 2013-04-27 23:38:41

+0

不,我一直在尋找靈感,瀏覽一些管理面板模板,並將其作爲一個兩列的模板。它是我想要的100%寬度/高度。 – 2013-04-27 23:54:04

+0

你能分享這個設計的鏈接嗎? – 2015-08-22 04:53:32

回答

7

我不太確定Bootstrap的網格模型是你在這裏找的。你可能正在尋找絕對定位。例如:

#sidebar, #content { 
    position: absolute; 
    top: 0; 
    bottom: 0; 
} 
#sidebar { left: 0; width: 10em; } 
#content { left: 10em; right: 0; } 

Try it out.

1

我不知道如果這是你在找什麼,but here it goes.

剛修改過的CSS略。 margin:0;html, body標籤。