Skip to content

Instantly share code, notes, and snippets.

@stacyk
Last active August 29, 2015 14:12
Show Gist options
  • Save stacyk/a4968c465a17686e52bf to your computer and use it in GitHub Desktop.
Save stacyk/a4968c465a17686e52bf to your computer and use it in GitHub Desktop.
Omega-Reset used for Columns at Different Breakpoints
<ol class="four">
<li>This is list item 1.</li>
<li>This is step 2</li>
<li>Right here, this is step three</li>
<li>4 is more!</li>
</ol>
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// Bourbon (v4.2.0)
// Neat (v1.6.0)
// ----
@import "bourbon/bourbon";
@import "neat/neat";
// ------------------------------------------------------------
// Omega Reset
// ------------------------------------------------------------
@mixin omega-reset($nth) {
&:nth-child(#{$nth}) { margin-right: flex-gutter(); }
&:nth-child(#{$nth}+1) { clear: none }
}
$breakpoints: (
large: 1100px,
medium: 900px
);
@mixin wider-than($screen-size) {
@if map-has-key($breakpoints, $screen-size) {
@media (min-width: map-get($breakpoints, $screen-size)) {
@content;
}
} @else {
// Debugging - can be used thanks to map-has-key() instead of loop
@warn "Breakpoint '#{$screen-size}' does not exist!"
}
}
.four li {
@include fill-parent;
@include wider-than(medium) {
@include span-columns(6);
@include omega(2n);
}
@include wider-than(large) {
@include omega-reset(2n);
@include span-columns(3);
@include omega(4n);
}
}
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.four li {
width: 100%;
}
@media (min-width: 900px) {
.four li {
float: left;
display: block;
margin-right: 2.35765%;
width: 48.82117%;
}
.four li:last-child {
margin-right: 0;
}
.four li:nth-child(2n) {
margin-right: 0;
}
.four li:nth-child(2n+1) {
clear: left;
}
}
@media (min-width: 1100px) {
.four li {
float: left;
display: block;
margin-right: 2.35765%;
width: 23.23176%;
}
.four li:nth-child(2n) {
margin-right: 2.35765%;
}
.four li:nth-child(2n+1) {
clear: none;
}
.four li:last-child {
margin-right: 0;
}
.four li:nth-child(4n) {
margin-right: 0;
}
.four li:nth-child(4n+1) {
clear: left;
}
}
<ol class="four">
<li>This is list item 1.</li>
<li>This is step 2</li>
<li>Right here, this is step three</li>
<li>4 is more!</li>
</ol>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment