Skip to content

Instantly share code, notes, and snippets.

@jcroft
Created February 6, 2012 21:51
Show Gist options
  • Select an option

  • Save jcroft/1755160 to your computer and use it in GitHub Desktop.

Select an option

Save jcroft/1755160 to your computer and use it in GitHub Desktop.

Revisions

  1. Jeff Croft revised this gist Feb 6, 2012. 2 changed files with 21 additions and 23 deletions.
    24 changes: 1 addition & 23 deletions example.sass → input.sass
    Original file line number Diff line number Diff line change
    @@ -13,26 +13,4 @@
    +column(70%)

    #sidebar
    +column(30%)


    // Output...
    #main-content {
    width: 70%;
    float: left;
    }

    #sidebar {
    width: 30%;
    float: left;
    }

    @media only screen and (min-width: 600px) {
    #main-content {
    width: 100%;
    }
    #sidebar {
    width: 100%;
    }
    }
    +column(30%)
    20 changes: 20 additions & 0 deletions output.css
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    // Output...

    #main-content {
    width: 70%;
    float: left;
    }

    #sidebar {
    width: 30%;
    float: left;
    }

    @media only screen and (min-width: 600px) {
    #main-content {
    width: 100%;
    }
    #sidebar {
    width: 100%;
    }
    }
  2. Jeff Croft created this gist Feb 6, 2012.
    38 changes: 38 additions & 0 deletions example.sass
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,38 @@
    // Typical grid column mixin..
    =column($percent)
    width: $percent
    float: left

    // Fancy new pseudo-selector syntax for media queries which would let my
    // column from above switch to 100% when the window got narrower than 600px...
    &@media only screen and (min-width: 600px)
    width: 100%

    // Apply the mixin to some elements...
    #main-content
    +column(70%)

    #sidebar
    +column(30%)


    // Output...
    #main-content {
    width: 70%;
    float: left;
    }

    #sidebar {
    width: 30%;
    float: left;
    }

    @media only screen and (min-width: 600px) {
    #main-content {
    width: 100%;
    }
    #sidebar {
    width: 100%;
    }
    }