Responsive CSS square - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Layout

Description

Responsive CSS square

Demo Code

ResultView the demo in separate window

<html lang="en">
 <head> 
  <style>
.outer {<!--from   w  ww  .j  a  v a 2 s  .co m-->
   width:21%;
   padding-bottom:21%;
   background:Chartreuse;
   position:relative;
}

.inner {
   position:absolute;
   top:11px;
   left:11px;
   right:11px;
   bottom:11px;
}
</style> 
 </head> 
 <body> 
  <div class="outer"> 
   <div class="inner"> 
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi u</p> 
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi u</p> 
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi u</p> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials