Creating a 2 Column (Fixed - Fluid) Layout with Twitter Bootstrap
In this article, we'll delve into whether it's feasible to achieve a two-column layout with a fixed-width sidebar and a fluid-width main content area using Twitter Bootstrap. We'll provide comprehensive explanations and solutions to guide your development.
Is it Possible with Twitter Bootstrap?
Twitter Bootstrap initially included a fixed-fluid layout option through the ".container-fluid" class. However, with the release of version 2.0, this feature was removed. Hence, it's not possible to implement a fixed-fluid layout solely using the standard Bootstrap classes.
Solution
1. Fixed-Fluid Layout
We can implement a fixed-fluid layout using a combination of modified HTML and CSS:
HTML:
<div>
CSS:
.fixed { width: 150px; float: left; } .fixed + div { margin-left: 150px; overflow: hidden; } html, body { height: 100%; } .fill { min-height: 100%; position: relative; } .filler::after{ background-color:inherit; bottom: 0; content: ""; height: auto; min-height: 100%; left: 0; margin:inherit; right: 0; position: absolute; top: 0; width: inherit; z-index: -1; }
2. Equal Column Heights (Optional)
To achieve equal heights for the sidebar and content area:
HTML:
<div>
Notes:
以上是Twitter Bootstrap 是否可用於建立具有固定寬度側邊欄和流動寬度主要內容區域的兩列佈局?的詳細內容。更多資訊請關注PHP中文網其他相關文章!