Responsive CSS Column Layout
A simple CSS layout using floated columns that stack on mobile screens using a media query. Supports full-width, narrow (30%), and wide (70%) column variants.
CSS
.columnfull { float: left; width: 50%; padding: 0 10px; }
.columnsmall { float: left; width: 30%; padding: 0 10px; }
.columnbig { float: left; width: 70%; padding: 0 10px; }
/* Clearfix for the row container */
.rownew:after { content: ""; display: table; clear: both; }
/* Stack columns on screens narrower than 600px */
@media screen and (max-width: 600px) {
.columnfull, .columnsmall, .columnbig {
width: 100%;
text-align: center;
}
}
Example HTML
<div class="rownew">
<div class="columnfull">
<h3>Column 1</h3>
<p>Content here</p>
</div>
<div class="columnfull">
<h3>Column 2</h3>
<p>Content here</p>
</div>
</div>
Notes
- For modern layouts, prefer CSS Grid or Flexbox over floats.
- The
.rownew:afterclearfix prevents the parent from collapsing around floated children. - Adjust the
max-widthbreakpoint to match your design's mobile threshold.