CSS snippet for a fluid responsive 4 column layout.
4 Column Layout with equal width content
HTML
<div class="col-four"> </div> <div class="col-four"> </div> <div class="col-four"> </div> <div class="col-four"> </div> <div class="clear"></div>
CSS
.col-four { width: 22%; float: left; margin-right: 4%; } .col-four:last-child { margin-right: 0; } .clear { clear: both; }
Responsive CSS Tablet View
@media screen and (max-width : 1024px) { .col-four { width: 50%; float: left; margin-right: 0; padding: 15px; } }
Responsive CSS Mobile View
@media screen and (max-width : 767px) { .col-four { width: 100%; float: none; padding: 15px 0; } }
1024px and 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