create 'responsive' lists: creating multiple columns to fit available width - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Layout

Description

create 'responsive' lists: creating multiple columns to fit available width

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <title>Lorem ipsum dolor sit amet, </title> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
body {<!--from  w w w  .j av  a  2 s . co  m-->
   margin:0;
   border:none;
}

.outer {
   width:100%;
}

.inner1 {
   clear:both;
   float:left;
   display:inline-block;
   width:33%;
}

.inner2 {
   display:inline-block;
   width:33%;
}

.inner3 {
   display:inline-block;
   width:33%;
}

@media only screen and (max-width: 420px)  {
   .inner1, .inner2, .inner3 {
      display:block;
      width:100%;
   }

}
</style> 
 </head> 
 <body> 
  <div class="outer"> 
   <div class="inner1">
     Lorem i 
   </div> 
   <div class="inner2">
     Lorem i 
   </div> 
   <div class="inner3">
     Lor 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials