Created
May 2, 2014 15:09
-
-
Save jdsteinbach/11477555 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ---- | |
| // Sass (v3.3.6) | |
| // Compass (v1.0.0.alpha.18) | |
| // ---- | |
| /* | |
| My idea here is that I could create a %grid placeholder, | |
| extend it with BEM/OOCSS-ish classes, then get the specific | |
| CSS "sub-classes" I need from the placeholder. IOW, I want | |
| .x{@extend %grid} to create .x-item & .x-item-title too. | |
| Is this possible with a placeholder? I know I can do it | |
| with a @mixin (see below). | |
| */ | |
| /* @extend %placeholder doesn't work. */ | |
| %grid { | |
| width: 100%; | |
| &-item { | |
| width: 33%; | |
| margin-right: 3%; | |
| &:nth-of-type(3n) { | |
| margin-right: 0; | |
| } | |
| &-title { | |
| text-transform: uppercase; | |
| line-height: 1; | |
| text-align: center; | |
| } | |
| } | |
| } | |
| .products, | |
| .services { | |
| @extend %grid; | |
| } | |
| /*This section shows how the @mixin can generate the code I need.*/ | |
| $grid-prefixes: (products,services); | |
| @each $prefix in $grid-prefixes { | |
| .#{$prefix} { | |
| width: 100%; | |
| &-item { | |
| width: 33%; | |
| margin-right: 3%; | |
| &:nth-of-type(3n) { | |
| margin-right: 0; | |
| } | |
| &-title { | |
| text-transform: uppercase; | |
| line-height: 1; | |
| text-align: center; | |
| } | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| My idea here is that I could create a %grid placeholder, | |
| extend it with BEM/OOCSS-ish classes, then get the specific | |
| CSS "sub-classes" I need from the placeholder. IOW, I want | |
| .x{@extend %grid} to create .x-item & .x-item-title too. | |
| Is this possible with a placeholder? I know I can do it | |
| with a @mixin (see below). | |
| */ | |
| /* @extend %placeholder doesn't work. */ | |
| .products, | |
| .services { | |
| width: 100%; | |
| } | |
| /*This section shows how the @mixin can generate the code I need.*/ | |
| .products { | |
| width: 100%; | |
| } | |
| .products-item { | |
| width: 33%; | |
| margin-right: 3%; | |
| } | |
| .products-item:nth-of-type(3n) { | |
| margin-right: 0; | |
| } | |
| .products-item-title { | |
| text-transform: uppercase; | |
| line-height: 1; | |
| text-align: center; | |
| } | |
| .services { | |
| width: 100%; | |
| } | |
| .services-item { | |
| width: 33%; | |
| margin-right: 3%; | |
| } | |
| .services-item:nth-of-type(3n) { | |
| margin-right: 0; | |
| } | |
| .services-item-title { | |
| text-transform: uppercase; | |
| line-height: 1; | |
| text-align: center; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment