Layout Absolute bottom positioned in scroll div - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Absolute Position

Description

Layout Absolute bottom positioned in scroll div

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
body, html {
   height:100%;
   margin:0;
}

* {<!--from  ww  w . jav a2  s .  co m-->
   box-sizing:border-box;
}

.container {
   height:201px;
   position:relative;
   overflow:auto;
   margin-bottom:21px;
}

p {
   margin:0;
}

.buttons {
   position:absolute;
   bottom:0;
}

.pink {
   background:pink;
}

.tomato {
   background:tomato;
}

.another-container {
   min-height:201px;
   position:relative;
   padding-bottom:31px;
}
</style> 
 </head> 
 <body> 
  <div class="container pink"> 
   <div class="another-container"> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <div class="buttons"> 
     <button>ok</button> 
     <button>cancel</button> 
    </div> 
   </div> 
  </div> 
  <div class="container tomato"> 
   <div class="another-container"> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <p>content</p> 
    <div class="buttons"> 
     <button>ok</button> 
     <button>cancel</button> 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials