Give same margin to 'top' and 'bottom' as margin of 'right' and 'left' in responsive design - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Layout

Description

Give same margin to 'top' and 'bottom' as margin of 'right' and 'left' in responsive design

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <title>Lorem ipsum dolor sit a</title> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
div.container {<!--from ww  w  . j a va2s.  c o  m-->
   background:Chartreuse;
   width:81%;
   height:81%;
   position:absolute;
   top:0;
   bottom:0;
   left:0;
   right:0;
   margin:auto;
   overflow-y:scroll;
}

.content {
   background:yellow;
   height:201px;
}
</style> 
 </head> 
 <body> 
  <div class="container"> 
   <div class="content">
     Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper molestie lacus sed fermentum. Aliquam erat volutpat. Vestibulum tortor neque, 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials