html - Position element to the bottom of a height: 100% div -


i "pin" button bottom of sidebar-div has height of 100%, should fill whole left side of page.

i tried way:

.sidebar {    height: 100%;    position: relative;    background-color: #cccccc;   }  .btn {    position: absolute;    bottom:0px;    top: auto;   }
<div class="sidebar">    <button class="btn">button</button>  </div>

it might because of height in percent, works pixel-height, there must way of getting done percent, sidebar must span entire page height.

to fix this, give html , body height of 100% follows. right don't have defined height set (so 0px high), button technically @ bottom.

live example:

html, body {    height: 100%;  }    .sidebar {    height: 100%;    position: relative;    background-color: #cccccc;   }  .btn {    position: absolute;    bottom:0;   }
<div class="sidebar">    <button class="btn">button</button>  </div>


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -