Skip to content

Instantly share code, notes, and snippets.

@Leko
Created June 25, 2013 02:13
Show Gist options
  • Save Leko/5855387 to your computer and use it in GitHub Desktop.
Save Leko/5855387 to your computer and use it in GitHub Desktop.
mixins of FizzBuzz by Sass
@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