Skip to content

Instantly share code, notes, and snippets.

@jensgro
Created June 17, 2013 20:05
Show Gist options
  • Save jensgro/5799857 to your computer and use it in GitHub Desktop.
Save jensgro/5799857 to your computer and use it in GitHub Desktop.
Einfacher Grid-Generator mit Sass
// ---
// Sass (v3.2.9)
// ---
$seitenbreite: 960px;
$anzahl-grids: 6;
$horizontaler-abstand: 10px;
$eine-spalte: $seitenbreite / $anzahl-grids;
$eine-spalte-prozent: $eine-spalte/$seitenbreite*100 *1%;
//$eine-spalte-prozent: ($seitenbreite / $anzahl-grids) / $seitenbreite*100;
@for $i from 1 to $anzahl-grids {
.grid#{$i} { width: $eine-spalte-prozent * $i;}
}
.grid1-test {
width: $seitenbreite/$anzahl-grids - $horizontaler-abstand * 2;
}
.grid1-test-prozent {
width: $eine-spalte-prozent;
}
.grid1 {
width: 16.66667%;
}
.grid2 {
width: 33.33333%;
}
.grid3 {
width: 50.0%;
}
.grid4 {
width: 66.66667%;
}
.grid5 {
width: 83.33333%;
}
.grid1-test {
width: 140px;
}
.grid1-test-prozent {
width: 16.66667%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment