Home >Web Front-end >CSS Tutorial >Can Bootstrap Create Fixed and Fluid Column Layouts?
How to Create a 2 Column Fluid-Fixed Layout with Twitter Bootstrap
Question:
Can you implement a fixed-fluid two-column layout using Twitter Bootstrap?
Solution:
Yes, it is possible with Bootstrap 2.0 onwards but requires some modification to the standard class implementation. Here's a solution using HTML and CSS:
HTML:
<div class="container-fluid fill"> <div class="row-fluid"> <div class="fixed"> <!-- Fixed width div --> ... </div> <div class="hero-unit filler"> <!-- Filler div without spanX class --> ... </div> </div> </div>
CSS:
/* Fixed-fluid layout */ .fixed { width: 150px; float: left; } .fixed + div { margin-left: 150px; overflow: hidden; } /* Equal height columns (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; }
Explanation:
The above is the detailed content of Can Bootstrap Create Fixed and Fluid Column Layouts?. For more information, please follow other related articles on the PHP Chinese website!