Dumb Grids with Susy

in CSS , Susy

Susy might be my new favorite thing… at least in CSS.

I say “dumb grids” with nothing but love, because in this case “dumb” means “not too magic and easy to grok”. Without providing any configuration to Susy you can do this:

 1.container {
 2  @include container;
 3
 4  /* this is our grid breakpoint, ~ a medium width */
 5  @media (min-width: 50em) {
 6    max-width: 50em;
 7
 8    .half {
 9      @include span(1 of 2);
10    }
11    .third {
12      @include span(1 of 3);
13    }
14    .half, .third {
15      &.last {
16        @include last;
17      }
18    }
19  }
20
21  /* this is our "desktop" width */
22  @media (min-width: 65em) {
23    max-width: 65em;
24  }
25}

So now, without having to define any grid settings, we have basic support for half- and third-width grids inside of containers that snap to fixed widths at breakpoints.

Neat, huh?