CSS snippet for a fluid responsive 3 column layout.
1/3 + 1/3 + 1/3 responsive 3 column layout
Three Column Layout with equal width content
HTML
<div class="col-one"> </div> <div class="col-two"> </div> <div class="col-three"> </div> <div class="clear"></div>
CSS
.col-one, .col-two, .col-three { width: 30%; float: left; margin-right: 5% } .col-three { margin-right: 0; } .clear { clear: both; }
Responsive CSS
@media screen and (max-width : 767px) { .col-one, .col-two, .col-three { width: 100%; float: none; margin: 0; } .col-one, .col-two { padding-bottom: 30px; } }
1/2 + 1/4 + 1/4 responsive 3 column layout
Three Column Layout with 1/2 + 1/4 + 1/4 layout
HTML
<div class="col-one"> </div> <div class="col-two"> </div> <div class="col-three"> </div> <div class="clear"></div>
CSS
.col-one { float: left; width: 48%; margin-right: 2%; } .col-two, .col-three { float: left; width: 24%; margin-right: 2%; } .col-three { margin-right: 0; } .clear { clear: both; }
Responsive CSS
@media screen and (max-width : 767px) { .col-one, .col-two, .col-three { width: 100%; float: none; margin: 0; } .col-one, .col-two { padding-bottom: 30px; } }
1/4 + 1/2 + 1/4 responsive 3 column layout
Three Column Layout with 1/4 + 1/2 + 1/4 responsive 3 column layout layout
HTML
<div class="col-one"> </div> <div class="col-two"> </div> <div class="col-three"> </div> <div class="clear"></div>
CSS
.col-one, .col-three { float: left; width: 24%; margin-right: 2%; } .col-two { float: left; width: 48%; margin-right: 2%; } .col-three { margin-right: 0; } .clear { clear: both; }
Responsive CSS
@media screen and (max-width : 767px) { .col-one, .col-two, .col-three { width: 100%; float: none; margin: 0; } .col-one, .col-two { padding-bottom: 30px; } }
1/4 + 1/4 + 1/2 responsive 3 column layout
Three Column Layout with 1/4 + 1/4 + 1/2 layout
HTML
<div class="col-one"> </div> <div class="col-two"> </div> <div class="col-three"> </div> <div class="clear"></div>
CSS
.col-one, .col-two { float: left; width: 24%; margin-right: 2%; } .col-three { float: left; width: 48%; margin-right: 0; } .clear { clear: both; }
Responsive CSS
@media screen and (max-width : 767px) { .col-left, .col-right { width: 100%; float: none; } .col-left { padding-bottom: 30px; } }
Note
@media screen and (max-width : 767px) {
767px is the viewport width, i.e. the width of the screen or the browser viewport. 768px is the portrait width of iPad 2, so anything under that is mostly considered as mobile viewport, if you wish to make the responsive css trigger before, change 767px to something higher