HTML CSS examples for CSS Property:padding
CSS calc() function to respect bottom padding
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .main-content {<!-- w w w . java 2 s. c om--> width:100%; background-color:Chartreuse; height:301px; } .header { background-color:yellow; height:51px; } .content:after { content:""; display:block; height:21px; width:100%; } .content { background-color:blue; padding-top:21px; padding-left:21px; height:calc(100% - 51px); overflow:auto; position:relative; } </style> </head> <body> <div class="main-content"> <div class="header"> Lorem ip </div> <div class="content"> Lorem ips <div class="long-content"> Lorem ipsum do <br>Lorem ipsum do <br>Lorem ipsum do <br>Lorem ipsum do <br>Lorem ipsum do <br>Lorem ipsum do <br>Lorem ipsum do <br>Lorem ipsum do <br>Lorem ipsum do <br>Lorem ipsum do <br>Lorem ipsum do <br>Lorem ipsum do <br>Lorem ipsum do <br>Lorem ipsum do <br>Lorem ipsum do <br>Lorem ipsum do <br>Lorem ipsum do <br> <button type="button">Lorem </button> </div> </div> </div> </body> </html>