Responsive 3 div side by side with image - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Layout

Description

Responsive 3 div side by side with image

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 {<!--from  ww  w . j  av a2 s  .  c  o m-->
   clear:both;
   padding:0px;
   margin:0px;
   overflow:hidden;
}

.col>img {
   float:left;
}

.profile1 {
   background-color:Chartreuse;
}

.profile2 {
   background-color:yellow;
}

.profile3 {
   background-color:blue;
}

@media only screen and (min-width: 480px)  {
   .span_1_of_3 {
      width:33.3%;
   }
   
   .col {
      display:block;
      float:left;
      margin:2% 0 2% 2.7%;
   }
   
   .col:first-child {
      margin-left:0;
   }

}
</style> 
 </head> 
 <body> 
  <div style="border:2px solid black;" class="container"> 
   <div class="col span_1_of_3 profile1"> 
    <img src="https://www.java2s.com/style/demo/Safari.png">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper molestie lacus sed fermentum. Aliquam erat volutpat. Vestibulum tortor neque, ornare vitae tempor hendrerit, luctus at neque. Phasellus sed quam pharetra, tincidunt tortor in, pharetra nisl. Maecenas aliquam luctus mauris, vitae venenatis diam imperdiet vel. Donec tortor diam, pretium vitae nibh vitae, consectetur lacinia sem. Proin luctus facilisis volutpat. Ut semper sit amet purus quis ornare. Quisque lobortis neque vitae te 
   </div> 
   <div class="col span_1_of_3 profile2"> 
    <img src="https://www.java2s.com/style/demo/Firefox.png">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper molestie lacus sed fermentum. Aliquam erat volutpat. Vestibulum tortor neque, ornare vitae tempor hendrerit, luctus at neque. Phasellus sed quam pharetra, tincidunt tortor in, pharetra nisl. Maecenas aliquam luctus mauris, vitae venenatis diam imperdiet vel. Donec tortor diam, pretium vitae nibh vitae, consectetur lacinia sem. Proin luctus facilisis volutpat. Ut semper sit amet purus quis ornare. Quisque lobortis neque vitae te 
   </div> 
   <div class="col span_1_of_3 profile3"> 
    <img src="https://www.java2s.com/style/demo/Google-Chrome.png">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper molestie lacus sed fermentum. Aliquam erat volutpat. Vestibulum tortor neque, ornare vitae tempor hendrerit, luctus at neque. Phasellus sed quam pharetra, tincidunt tortor in, pharetra nisl. Maecenas aliquam luctus mauris, vitae venenatis diam imperdiet vel. Donec tortor diam, pretium vitae nibh vitae, consectetur lacinia sem. Proin luctus facilisis volutpat. Ut semper sit amet purus quis ornare. Quisque lobortis neque vitae te 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials