I'm currently converting a CSS 960 fluid grid to SASS. How can I improve my current implementation? My column classes .two.columns
are getting a bit unruly. Is there a better way to write them?
// Variables
$width: 960px;
.container {
position: relative;
width: $width;
margin: 0 auto;
padding: 0;
.column, .columns {
float: left;
display: inline;
margin-left: 10px;
margin-right: 10px;
}
}
.row {
margin-bottom: 20px;
}
// Nested Column Classes
.column.alpha, .columns.alpha {
margin-left: 0;
}
.column.omega, .columns.omega {
margin-right: 0;
}
// 960 GRID
// (1 * (960 / 16)) - (2 * 10)
.container {
.one {
&.column, &.columns {
width: 40px;
}
}
.two.columns {
width: 100px;
}
.three.columns {
width: 160px;
}
.four.columns {
width: 220px;
}
.five.columns {
width: 280px;
}
.six.columns {
width: 340px;
}
.seven.columns {
width: 400px;
}
.eight.columns {
width: 460px;
}
.nine.columns {
width: 520px;
}
.ten.columns {
width: 580px;
}
.eleven.columns {
width: 640px;
}
.twelve.columns {
width: 700px;
}
.thirteen.columns {
width: 760px;
}
.fourteen.columns {
width: 820px;
}
.fifteen.columns {
width: 880px;
}
.sixteen.columns {
width: 940px;
}
.one-third.column {
width: 300px;
}
.two-thirds.column {
width: 620px;
}
.offset-by-one {
padding-left: 60px;
}
.offset-by-two {
padding-left: 120px;
}
.offset-by-three {
padding-left: 180px;
}
.offset-by-four {
padding-left: 240px;
}
.offset-by-five {
padding-left: 300px;
}
.offset-by-six {
padding-left: 360px;
}
.offset-by-seven {
padding-left: 420px;
}
.offset-by-eight {
padding-left: 480px;
}
.offset-by-nine {
padding-left: 540px;
}
.offset-by-ten {
padding-left: 600px;
}
.offset-by-eleven {
padding-left: 660px;
}
.offset-by-twelve {
padding-left: 720px;
}
.offset-by-thirteen {
padding-left: 780px;
}
.offset-by-fourteen {
padding-left: 840px;
}
.offset-by-fifteen {
padding-left: 900px;
}
}