Created
October 21, 2015 15:28
-
-
Save Undistraction/8e4ccea9959615a5b4ae 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
<ul class="List--from-left List--space-before"> | |
<li>Alpha</li> | |
<li>Beta</li> | |
<li>Charlie</li> | |
<li>Delta</li> | |
</ul> | |
<ul class="List--from-left List--space-after"> | |
<li>Alpha</li> | |
<li>Beta</li> | |
<li>Charlie</li> | |
<li>Delta</li> | |
</ul> | |
<ul class="List--from-right List--space-before"> | |
<li>Alpha</li> | |
<li>Beta</li> | |
<li>Charlie</li> | |
<li>Delta</li> | |
</ul> | |
<ul class="List--from-right List--space-after"> | |
<li>Alpha</li> | |
<li>Beta</li> | |
<li>Charlie</li> | |
<li>Delta</li> | |
</ul> |
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.4.14) | |
// Compass (v1.0.3) | |
// ---- | |
// Reset | |
ul, li { | |
margin: 0; | |
padding: 0; | |
list-style: none; | |
} | |
ul { | |
margin-bottom: 20px; | |
clear: both; | |
float: left; | |
} | |
li { | |
padding: 20px; | |
background: grey; | |
font: sans-serif; | |
text-transform: uppercase; | |
width: 100px; | |
} | |
@mixin floated-list($start-from:left, $spacing:0, $child:li, $spacing-position:before) { | |
// Test for accepted values | |
@if not index(left right, $start-from) { | |
@error "`#{$start-from}` is not a supported value for `$start-from`. Must be either `left` or `right`"; | |
} | |
@if not index(before after, $spacing-position) { | |
@error "`#{$spacing-position}` is not a supported value for `$spacing-position`. Must be either `before` or `after`"; | |
} | |
$margin-direction: null; | |
$child-cancel-position: null; | |
@if(($start-from == left and $spacing-position == after) or ($start-from == right and $spacing-position == before)) { | |
$margin-direction: right; | |
} @else { | |
$margin-direction: left; | |
} | |
@if(($start-from == left and $spacing-position == after) or ($start-from == right and $spacing-position == after)) { | |
$child-cancel-position: last-child; | |
} @else { | |
$child-cancel-position: first-child; | |
} | |
#{$child} { | |
float: $start-from; | |
margin-#{$margin-direction}: #{$spacing}; | |
@content; | |
&:#{$child-cancel-position} { | |
margin-#{$margin-direction}: 0; | |
} | |
} | |
} | |
.List--from-left.List--space-before { | |
@include floated-list(left, 20px, 'li', before) { | |
color: white; | |
} | |
} | |
.List--from-left.List--space-after { | |
@include floated-list(left, 20px, 'li', after) { | |
color: white; | |
} | |
} | |
.List--from-right.List--space-before { | |
@include floated-list(right, 20px, 'li', before) { | |
color: white; | |
} | |
} | |
.List--from-right.List--space-after { | |
@include floated-list(right, 20px, 'li', after) { | |
color: white; | |
} | |
} |
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
ul, li { | |
margin: 0; | |
padding: 0; | |
list-style: none; | |
} | |
ul { | |
margin-bottom: 20px; | |
clear: both; | |
float: left; | |
} | |
li { | |
padding: 20px; | |
background: grey; | |
font: sans-serif; | |
text-transform: uppercase; | |
width: 100px; | |
} | |
.List--from-left.List--space-before li { | |
float: left; | |
margin-left: 20px; | |
color: white; | |
} | |
.List--from-left.List--space-before li:first-child { | |
margin-left: 0; | |
} | |
.List--from-left.List--space-after li { | |
float: left; | |
margin-right: 20px; | |
color: white; | |
} | |
.List--from-left.List--space-after li:last-child { | |
margin-right: 0; | |
} | |
.List--from-right.List--space-before li { | |
float: right; | |
margin-right: 20px; | |
color: white; | |
} | |
.List--from-right.List--space-before li:first-child { | |
margin-right: 0; | |
} | |
.List--from-right.List--space-after li { | |
float: right; | |
margin-left: 20px; | |
color: white; | |
} | |
.List--from-right.List--space-after li:last-child { | |
margin-left: 0; | |
} |
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
<ul class="List--from-left List--space-before"> | |
<li>Alpha</li> | |
<li>Beta</li> | |
<li>Charlie</li> | |
<li>Delta</li> | |
</ul> | |
<ul class="List--from-left List--space-after"> | |
<li>Alpha</li> | |
<li>Beta</li> | |
<li>Charlie</li> | |
<li>Delta</li> | |
</ul> | |
<ul class="List--from-right List--space-before"> | |
<li>Alpha</li> | |
<li>Beta</li> | |
<li>Charlie</li> | |
<li>Delta</li> | |
</ul> | |
<ul class="List--from-right List--space-after"> | |
<li>Alpha</li> | |
<li>Beta</li> | |
<li>Charlie</li> | |
<li>Delta</li> | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment