Home > Article > Web Front-end > How to Create a Fixed-Fluid 2-Column Layout with Twitter Bootstrap?
Creating a 2-column layout with one fixed-width column and one fluid-width column is a common design pattern. Earlier versions of Twitter Bootstrap allowed this using the .container-fluid class, but this is no longer supported in Bootstrap 2.0 and later.
To address this, we can employ a combination of CSS and slightly modified HTML code:
<div class="container-fluid fill"> <div class="row-fluid"> <div class="fixed">...Fixed Column...</div> <div class="hero-unit filler">...Fluid Column...</div> </div> </div>
/* Fixed-Fluid Layout CSS */ .fixed { width: 150px; /* Fixed width for fixed column */ float: left; } .fixed + div { margin-left: 150px; /* Match fixed width from .fixed class */ overflow: hidden; } /* Content Height Equalization CSS (optional) */ 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; }
The above is the detailed content of How to Create a Fixed-Fluid 2-Column Layout with Twitter Bootstrap?. For more information, please follow other related articles on the PHP Chinese website!