Fixed margins on a responsive layout - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Layout

Description

Fixed margins on a responsive layout

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">
ul<!--from  ww  w  .  j  av a2s .c o  m-->
 {
   list-style:none;
   margin:0 0 0 -16px;
   padding:0;
   overflow:hidden;
}

li
 {
   float:left;
   width:34.3334%;
   padding:0 0 26px 16px;
   box-sizing:border-box;
}

div {
   padding:26px 0;
   color:Chartreuse;
   text-align:center;
}

div.red {
   background:red;
}

div.green {
   background:green;
}

div.blue {
   background:blue;
}
</style> 
 </head> 
 <body> 
  <ul> 
   <li> 
    <div class="red">
      Lorem 
    </div> </li> 
   <li> 
    <div class="green">
      Lorem i 
    </div> </li> 
   <li> 
    <div class="blue">
      Lorem 
    </div> </li> 
  </ul>  
 </body>
</html>

Related Tutorials