1. Set up your <meta>
1 | < meta name = "viewport" content = "width=device-width, initial-scale=1" > |
<meta name="viewport" content="width=device-width, initial-scale=1">
2. Set up the column
1 2 3 4 5 6 | .column { float: left; width: calc(100%/3); padding: 10px; height: 300px; /* Should be removed. Only for demonstration */ } |
.column { float: left; width: calc(100%/3); padding: 10px; height: 300px; /* Should be removed. Only for demonstration */ }
3. Set up the row
1 2 3 4 5 | .row:after { content: ""; display: table; clear: both; } |
.row:after { content: ""; display: table; clear: both; }
4. Set up the responsive layout
1 2 3 4 | @media screen and (max-width: 600px) { .column { width: 100%; } |
@media screen and (max-width: 600px) { .column { width: 100%; }
5. Set up the content
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | < div class = "row" > < div class = "column" style = "background-color:#aaa;" > < h2 >Column 1</ h2 > < p >Some text..</ p > </ div > < div class = "column" style = "background-color:#bbb;" > < h2 >Column 2</ h2 > < p >Some text..</ p > </ div > < div class = "column" style = "background-color:#ccc;" > < h2 >Column 3</ h2 > < p >Some text..</ p > </ div > </ div > < div class = "row" > < div class = "column" style = "background-color:#aaa;" > < h2 >Column 1</ h2 > < p >Some text..</ p > </ div > < div class = "column" style = "background-color:#bbb;" > < h2 >Column 2</ h2 > < p >Some text..</ p > </ div > < div class = "column" style = "background-color:#ccc;" > < h2 >Column 3</ h2 > < p >Some text..</ p > </ div > </ div > |
<div class="row"> <div class="column" style="background-color:#aaa;"> <h2>Column 1</h2> <p>Some text..</p> </div> <div class="column" style="background-color:#bbb;"> <h2>Column 2</h2> <p>Some text..</p> </div> <div class="column" style="background-color:#ccc;"> <h2>Column 3</h2> <p>Some text..</p> </div> </div> <div class="row"> <div class="column" style="background-color:#aaa;"> <h2>Column 1</h2> <p>Some text..</p> </div> <div class="column" style="background-color:#bbb;"> <h2>Column 2</h2> <p>Some text..</p> </div> <div class="column" style="background-color:#ccc;"> <h2>Column 3</h2> <p>Some text..</p> </div> </div>