Locked lesson.
About this lesson
Exercise files
Download this lesson’s related exercise files.
Grid View.docx58.8 KB Grid View - Solution.docx
59.5 KB
Quick reference
Grid View
Imagine your web page as being chopped up into a grid of equal columns.
When to use
Grid views are important for CSS design, but especially for mobile design.
Instructions
To create a 12 column grid:
* {
box-sizing: border-box;
}
[class*="col-"] {
float: left;
padding: 15px;
}
.col-1 {width: 8.33%;}
.col-2 {width: 16.66%;}
.col-3 {width: 25%;}
.col-4 {width: 33.33%;}
.col-5 {width: 41.66%;}
.col-6 {width: 50%;}
.col-7 {width: 58.33%;}
.col-8 {width: 66.66%;}
.col-9 {width: 75%;}
.col-10 {width: 83.33%;}
.col-11 {width: 91.66%;}
.col-12 {width: 100%;}
Hints & tips
- Grid Views are very important.
- It doesn't really matter how many columns you choose, but 12 is standard.
- Each column is 1/12th in size, or 8.33% (1 divided by 12; times 100 to make it a percentage)
Lesson notes are only available for subscribers.