Is it possible to create a 2 Column Layout (Fixed - Fluid) Layout ( http://www.dynamicdrive.com/style/layouts/item/css-liquid-layout-21-fixed-fluid/) with Twitter Bootstrap (http://twitter.github.com/bootstrap/)?
Do you have any solutions?
Is it possible to create a 2 Column Layout (Fixed - Fluid) Layout ( http://www.dynamicdrive.com/style/layouts/item/css-liquid-layout-21-fixed-fluid/) with Twitter Bootstrap (http://twitter.github.com/bootstrap/)?
Do you have any solutions?
The accepted answer seems to be fluid-fluid. Here is an answer that is actually fixed-fluid:
https://stackoverflow.com/a/9739345/237091
- Another Update -
Since Twitter Bootstrap version 2.0 - which saw the removal of the
.container-fluid
class - it has not been possible to implement a two column fixed-fluid layout using just the bootstrap classes - however I have updated my answer to include some small CSS changes that can be made in your own CSS code that will make this possibleIt is possible to implement a fixed-fluid structure using the CSS found below and slightly modified HTML code taken from the Twitter Bootstrap Scaffolding : layouts documentation page:
HTML
CSS
I have kept the answer below - even though the edit to support 2.0 made it a fluid-fluid solution - as it explains the concepts behind making the sidebar and content the same height (a significant part of the askers question as identified in the comments)
Important
Answer below is fluid-fluid
Update As pointed out by @JasonCapriotti in the comments, the original answer to this question (created for v1.0) did not work in Bootstrap 2.0. For this reason, I have updated the answer to support Bootstrap 2.0
To ensure that the main content fills at least 100% of the screen height, we need to set the height of the
html
andbody
to 100% and create a new css class called.fill
which has a minimum-height of 100%:We can then add the
.fill
class to any element that we need to take up 100% of the sceen height. In this case we add it to the first div:To ensure that the Sidebar and the Content columns have the same height is very difficult and unnecessary. Instead we can use the
::after
pseudo selector to add afiller
element that will give the illusion that the two columns have the same height:To make sure that the
.filler
element is positioned relatively to the.fill
element we need to addposition: relative
to.fill
:And finally add the
.filler
style to the HTML:HTML
Notes
right: 0
toleft: 0
.Update 2018
Bootstrap 4
Now that BS4 is flexbox, the fixed-fluid is simple. Just set the width of the fixed column, and use the
.col
class on the fluid column.http://www.codeply.com/go/7LzXiPxo6a
Bootstrap 3..
One approach to a fixed-fluid layout is using media queries that align with Bootstrap's breakpoints so that you only use the fixed width columns are larger screens and then let the layout stack responsively on smaller screens...
Working Bootstrap 3 Fixed-Fluid Demo
Related Q&A:
Fixed width column with a container-fluid in bootstrap
How to left column fixed and right scrollable in Bootstrap 4, responsive?