create horizontal elements in responsive way - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Layout

Description

create horizontal elements in responsive way

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">
.container {<!--  w ww .j a v a2s  .  com-->
}
.block {
   width:100px;
   height:100px;
   background:grey;
}

@media screen and (min-width : 320px) and (max-width : 480px)  {
   .container {
      white-space:nowrap;
      overflow-x:scroll;
   }
   
   .block {
      display:inline-block;
   }

}
</style> 
 </head> 
 <body> 
  <div class="container"> 
   <div class="block"></div> 
   <div class="block"></div> 
   <div class="block"></div> 
   <div class="block"></div> 
   <div class="block"></div> 
   <div class="block"></div> 
   <div class="block"></div> 
   <div class="block"></div> 
   <div class="block"></div> 
   <div class="block"></div> 
  </div>  
 </body>
</html>

Related Tutorials