Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAurelian Spodarec
10,801 PointsHow to make grid system with Sass?
Hi,
I have watched the video on how to make grid system with Sass here on TTH.
I understand it somewhat.
Though, I have a CSS grid system, and how do I make this into Sass? Would be even better to use SMACSS methology with BEM. This here I just did on something that I like, with 1-2 etc.. seems clean to me.
// ==========================================================================
// Grid System
// ==========================================================================
.row,
.row:before,
.row:after {
content:"";
display: table ;
clear:both;
width: 100%;
}
.col {
position: relative;
min-height: 1px;
padding-left: 15px;
padding-right: 15px;
float: left;
}
.col-np {
position: relative;
min-height: 1px;
float: left;
}
//All
.all-1 {
width: 100%;
}
.all-1-2 {
width: 50%;
}
.all-1-3 {
width: 33.3333%;
}
//Extra Small
@include mq(xs-only) {
.xs-1 {
width: 100%;
}
.xs-1-2 {
width: 50%;
}
.xs-1-3 {
width: 33.3333%;
}
.xs-2-3 {
width: 66.6666%;
}
.xs-1-4 {
width: 25%;
}
}
//Small
@include mq(small) {
.small-1 {
width: 100%;
}
.small-1-2 {
width: 50%;
}
.small-1-3 {
width: 33.3333%
}
.small-2-3 {
width: 66.6666%
}
.small-1-4 {
width: 25%
}
}
//Tablet
@include mq(medium) {
.medium-1 {
width: 100%;
}
.medium-1-2 {
width: 50%;
}
.medium-1-3 {
width: 33.3333%
}
.medium-2-3 {
width: 66.66666%;
}
.medium-3-4 {
width: 75%;
}
.medium-1-4 {
width: 25%
}
.medium-1-5 {
width: 20%;
}
}
//Desktop
@include mq(large-up) {
.large-1 {
width: 100%;
}
.large-1-2 {
width: 50%;
}
.large-1-3 {
width: 33.3333%
}
.large-2-3 {
width: 66.6666%;
}
.large-1-4 {
width: 25%;
}
.large-3-4 {
width: 75%;
}
.large-4-5 {
width: 80%;
}
.large-1-5 {
width: 20%;
}
.large-3-10 {
width: 30%;
}
.large-7-10 {
width: 70%;
}
}
1 Answer
jason chan
31,009 PointsI think you might need a loop. I would just fork already done project.
https://github.com/thoughtbot/neat
You still have to test it. I would just fork a finished version. If so, you can reverse engineer and look at the source.