css - How to make a 100% height container in Bootstrap 3 -


here's trying achieve.

enter image description here

my html looks like:

<body>  <header>  ... // bs sticky navbar - visible no matter  </header>  <main>    <div class="container">      <div class="row">      </div>    </div>  </main>  <footer>    .. // footer @ bottom content can push down  </footer> 

either .container or .row can white div. needs touch footer when there not enough content.

the main div must stay 100% width.

the solution must css , work in ie10+/modern browsers. ie9 great not necessary long alternative doesn't crap (i.e. footer in middle of text).

i have tried many solutions such as:

- http://thatemil.com/blog/2013/11/03/sticky-footers-flexbox-and-ie10/ - http://www.fredonism.com/archive/min-height-100-percent-and-sticky-footer.aspx 

unfortunately nothing found works. of solutions see not involve inner white div , use main one. 2nd solution linked above, example, shrinks main div white doesn't work in case. things 100vh don't seem work when content larger - end footer in middle of page on scroll.

browser support: ie9+/modern browsers.

jsfiddle - http://jsfiddle.net/z1ts4rro/

html {      position: relative;      min-height: 100%;  }  body {      background: lightgoldenrodyellow;      margin: 50px 0;  }  header, footer {      background: lightseagreen;      width: 100%;      height: 50px;  }  header {      position: fixed;      left: 0;      top: 0;  }  footer {      position: absolute;      left: 0;      bottom: 0;  }  .container {      width: 70%;      margin: 0 auto;      background: white;      min-height: calc(100vh - 100px);  }
<header>header</header>  <main>      <div class="container">lorem ipsum dolor sit amet, consectetur adipiscing elit. donec porttitor, augue vehicula pretium, arcu lorem interdum ligula, sed vehicula purus turpis et velit. praesent rhoncus venenatis malesuada. proin sem felis, vulputate eu tincidunt ac, dictum nec tellus. aliquam ex bibendum, porttitor ipsum id, varius leo. aliquam ornare suscipit justo vel rhoncus. integer sit amet risus nec lectus fermentum egestas. lorem ipsum dolor sit amet, consectetur adipiscing elit. maecenas nisl neque, aliquam in tincidunt vel, vehicula suscipit neque. quisque faucibus gravida lectus. ut porttitor tincidunt elementum. sed urna erat, pellentesque sit amet commodo vestibulum, eleifend ac diam.</div>  </main>  <footer>footer</footer>


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -