html - Make a sticky div in a bootstrap grid -


i'm looking way make div sticky bottom, footer, inside bootstrap grid, not on whole width.

bootstrap has example of sticky footer, tried tweak make work in case couldn't.

this approach, assumes sticky div not nested inside div.

below code, need make .app-footer sticky bottom on width of it's parent div.

<div class="row main">   <div class="col-xs-2 col-md-4 col-lg-5">...</div>    <div class="col-xs-8 col-md-4 col-lg-2">     <div class="app"></div>     <div class="app-footer"></div>   </div>    <div class="col-xs-2 col-md-4 col-lg-5">...</div> </div> 

edit: css i've tried doesn't work:

html, body {   height: 100%; }  /* wrapper page content push down footer */ .app {   min-height: 100%;   height: auto;   /* negative indent footer height */   margin: 0 auto -60px;   /* pad bottom footer height */   padding: 0 0 60px; }  /* set fixed height of footer here */ .app-footer {   height: 60px;   background-color: #f5f5f5; } 

edit: ok, got it. solution seems to add {position: relative; height: 100%} parent divs. in case had grid wrapped in <div class="row">, when added there worked.

if want make nested child div positioned bottom of parent div:

add {position:relative} css of the parent div; add {position:absolute;bottom:0} css of the child div;

the nested div should same width parent (taknig account padding , margins), force adding width:100% child div's css


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -