No matter the size of the browser, each of these columns will always have an equal width.
<div class="row"> <div class="col s1"><div>1</div></div> <div class="col s1"><div>2</div></div> <div class="col s1"><div>3</div></div> <div class="col s1"><div>4</div></div> <div class="col s1"><div>5</div></div> <div class="col s1"><div>6</div></div> <div class="col s1"><div>7</div></div> <div class="col s1"><div>8</div></div> <div class="col s1"><div>9</div></div> <div class="col s1"><div>10</div></div> <div class="col s1"><div>11</div></div> <div class="col s1"><div>12</div></div> </div>
Note: For now, just know that the s1
stands for small-1 which in plain English means "1 column on small screens".
Remember when you are creating your layout that all columns must be contained inside a row and that you must add the col
class to your inner divs to make them into columns
<div class="row"> <div class="col s12"><div>This div is 12-columns wide</div></div> <div class="col s6"><div>This div is 6-columns wide</div></div> <div class="col s6"><div>This div is 6-columns wide</div></div> </div>
To offset, simply add offset-s2
to the class where s
signifies the screen class-prefix (s = small, m = medium, l = large) and the number after is the number of columns you want to offset by.
<div class="row"> <div class="col s12"><span class="flow-text">This div is 12-columns wide on all screen sizes</span></div> <div class="col s6 offset-s6"><span class="flow-text">6-columns (offset-by-6)</span></div> </div>
Here we will show you how to create some commonly used layouts with our grid system. Hopefully these will get you more comfortable with laying out elements. To keep these demos simple, the ones here will not be responsive.
The section class is used for simple top and bottom padding. Just add the section
class to your div's containing large blocks of content.
Dividers are 1 pixel lines that help break up your content. Just add the divider
to a div in between your content.
Stuff
Stuff
Stuff
<div class="divider"></div> <div class="section"> <h5>Section 1</h5> <p>Stuff</p> </div> <div class="divider"></div> <div class="section"> <h5>Section 2</h5> <p>Stuff</p> </div> <div class="divider"></div> <div class="section"> <h5>Section 3</h5> <p>Stuff</p> </div>
Above we showed you how to layout elements using our grid system. Now we'll show you how to design your layouts so that they look great on all screen sizes.
Mobile Devices <= 600px | Tablet Devices <= 992px | Desktop Devices >= 992px | |
---|---|---|---|
Class Prefix | .s | .m | .l |
Number of Columns | 12 | 12 | 12 |
In the previous examples, we only defined the size for small screens using "col s12"
. This is fine if we want a fixed layout since the rules propogate upwards. By just saying s12, we are essentially saying "col s12 m12 l12"
. But by explicitly defining the size we can make our website more responsive.
<div class="row white-text center-align"> <div class="col s12"><div class="flow-text blue">I am always full-width (col s12)</div></div> <div class="col s12 m6"><div class="flow-text blue">I am full-width on mobile (col s12 m6)</div></div> </div>
<div class="row"> <div class="col s12"><div>s12</div></div> <div class="col s12 m3 l2"><div>s12 m4</div></div> <div class="col s12 m6 l8"><div>s12 m4</div></div> <div class="col s12 m3 l2"><div>s12 m4</div></div> </div> <div class="row"> <div class="col s12 m6 l3"><div>s12 m6 l3</div></div> <div class="col s12 m6 l3"><div>s12 m6 l3</div></div> <div class="col s12 m6 l3"><div>s12 m6 l3</div></div> <div class="col s12 m6 l3"><div>s12 m6 l3</div></div> </div>