// Based off of http://lemonade.im .ui-grid { // Helpers $full: 100%; $half: 100% / 2; // Media Queries Breakpoints $small: 30em; // Portrait mobile to landscape mobile $medium: 50em; // Portrait tablet to landscape tablet $large: 68.750em; // Small desktop to large desktop // Grid Padding $gridu-padding: 20px; // Grid widths $start: 1; $end: 12; // Commons widths $common: 25, 40, 60, 75; // Frame width (grid wrapper) $frame-width: 100%; // Start the grid. * { box-sizing: border-box; margin: 0; padding: 0; } // clearfix .photo-grid { max-width: $frame-width; margin: 0 auto; &:after { display: table; clear: both; content: ""; } } // Attribute selector [class*="gridu-"] { float: left; padding: $gridu-padding; } // Create grid widths (1-12) @for $i from $start through $end { .gridu-#{$i} { width: $full / $i; } } // Common widths @each $i in $common { .gridu-#{$i} { width: percentage($i / 100); } } // == Media Queries == // // Mobile @media (max-width: $small) { @for $i from $start through $end { .gridu-#{$i} { width: $full; } } } // Portrait Tablet @media (min-width: $small) and (max-width: $medium) { .gridu-4, .gridu-6, .gridu-8, .gridu-10, .gridu-12 { width: $half; } .gridu-1, .gridu-2, .gridu-3, .gridu-5, .gridu-7, .gridu-9, .gridu-11 { width: $full; } } // Landscape Tablet @media (min-width: $medium) and (max-width: $large) { .gridu-2, .gridu-7 { width: $full; } .gridu-4, .gridu-8, .gridu-10, .gridu-12 { width: $half; } } }