Reputation: 512
I am using twitter bootstrap, after reading all the answers on stack overflow to extend a div to the bottom i came up with this code for my sidebar.
body
<div id="wrapper-sidebar">
<div id="content-sidebar" class="text-center">
<h1> hello</h1>
<p>welcome to the admin panel</p>
<p>have a nice stay!</p>
</div>
</div>
css
#wrapper-sidebar
{
margin: 0 auto;
width: 300px;
height: 100%;
padding: 0;
position: absolute;
}
#content-sidebar
{
background-color: #f5f5f5;
border: 1px solid #e3e3e3;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
height: 100%;
padding-top: 5px;
}
.text-center
{
text-align: center;
}
Now this did make the sidebar extend till the bottom of my page but it also inserted a scroll-bar, and when i scroll down my text gets cut off. Any help would be appreciated. Does anyone know how to extend a div/sidebar (i.e, height=100%) using bootstrap css classes only?
jfiddle is here but it actually doesn't show the text being cut off thus i did not post it before.
Upvotes: 4
Views: 1742
Reputation: 13435
I believe the scrollbar is being introduced by the padding-top
and/or the border
. You may need to reduce your height to account for these.
Upvotes: 1