Created
June 25, 2013 02:13
-
-
Save Leko/5855387 to your computer and use it in GitHub Desktop.
mixins of FizzBuzz by Sass
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
@mixin fizzbuzz_content($n) { | |
$fb: '', '', Fizz, '', Buzz, Fizz, '', '', Fizz, Buzz, '', Fizz, '', '', FizzBuzz; | |
$cont: ''; | |
@for $i from 1 through $n { | |
@if nth($fb, ($i - 1) % 15 + 1) == '' { | |
$cont: $cont + $i + ' ' | |
} @else { | |
$cont: $cont + nth($fb, ($i - 1) % 15 + 1) + ' '; | |
} | |
} | |
&:after { content: $cont; } | |
} | |
@mixin fizzbuzz_nth($fs: 18px) { | |
li { | |
font-size: $fs; | |
display: inline-block; | |
} | |
li:nth-child(3n), li:nth-child(5n) { | |
font-size: 0; | |
} | |
li:nth-child(3n):before { | |
font-size: $fs; | |
content: "Fizz"; | |
} | |
li:nth-child(5n):after { | |
font-size: $fs; | |
content: "Buzz"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment