I am trying to implement a simple header + 2 column layout using twitter bootstrap.
I have a fixed header with 100% width, and I am now trying to have two fixed-width full-height columns with independent scrollbars. Is there any good way to do this with twitter bootstrap?
Here is a picture of the layout I am trying to build
Use bootstrap's 'pre-scrollable' class on your target div. Set div at some fixed max height. Its aesthetically good, as well.
I found a way to do it. Not sure it's the best, but it does the trick:
<html>
<head>
<link rel="stylesheet" media="screen" href="normalize.css">
<link rel="stylesheet" media="screen" href="bootstrap.min.css">
<style type="text/css">
body, html {
height: 100%;
overflow: hidden;
}
.navbar-inner {
height: 40px;
}
.scrollable {
height: 100%;
overflow: auto;
}
.max-height {
height: 100%;
}
.no-overflow {
overflow: hidden;
}
.pad40-top {
padding-top: 40px;
}
</style>
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
header contents
</div>
</div>
</div>
<div class="container max-height no-overflow">
<div class="row max-height">
<div class="span8 scrollable">
<div class="pad40-top">
main contents
</div>
</div>
<div class="span4 scrollable">
<div class="pad40-top">
right sidebar contents
</div>
</div>
</div>
</div>
</body>
http://jsfiddle.net/m4eS4/7/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With