-
-
Save zachharkey/5224086 to your computer and use it in GitHub Desktop.
A SASS(SCSS) Mixin to easily apply the [OOCSS Media object][stubbornella] to any component. Implements the code from this [Gist][github] which I forked from [Victa][github 2] to provide more SMACSS friendly default class names and reordered the arguments in based on my own frequency of use. [See it in action][codepen] [github]: https://gist.gith…
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
// OOCSS Media Object | |
@mixin media-object($img: '.media-img', $bd: '.media-bd', $margin:10px, $position: left, $formatting-context: 'overflow') { | |
@include pie-clearfix; // or extend a .clearfix class | |
#{unquote($bd)} { | |
@if $formatting-context == 'overflow' { | |
overflow:hidden; | |
} @else { | |
display:table-cell; | |
width:10000px; | |
*width:auto; | |
*zoom:1; | |
} | |
} | |
#{unquote($img)} { | |
float:$position; | |
img{display:block;} | |
@if $margin > 0 { | |
margin-#{opposite-position($position)}:$margin; | |
} | |
} | |
} |
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
.teaser { | |
@include media-object('.teaser-img', '.teaser-bd'); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment