How to create: Three-column layout
- Previous page Two-column layout
- Next page Four-column layout
Learn how to use CSS to create a three-column layout grid.
How to create a three-column layout
First step - Add HTML:
<div class="row"> <div class="column"></div> <div class="column"></div> <div class="column"></div> </div>
Second step - Add CSS:
In this example, we will create threeEqual widthColumns:
Example
.column { float: left; width: 33.33%; } /* Clear the float after the columns */ .row:after { content: ""; display: table; clear: both; }
In this example, we will create threeUnequal widthColumns:
Example
.column { float: left; } .left, .right { width: 25%; } .middle { width: 50%; }
In this example, we will create aResponsiveThree-column layout:
Example
/* Responsive layout - When the screen width is less than 600px, stack the three columns instead of displaying them side by side */ @media screen and (max-width: 600px) { .column { width: 100%; } }
Related pages
Tutorial:CSS website layout
Tutorial:CSS responsive web design
- Previous page Two-column layout
- Next page Four-column layout