Skip to content

Instantly share code, notes, and snippets.

@mogya
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mogya/8860493 to your computer and use it in GitHub Desktop.
Save mogya/8860493 to your computer and use it in GitHub Desktop.
Re:どうしてwebデザイナーに・・・CSSが書けないのか?
#main li:nth-of-type(3n),
#main li:nth-of-type(5n){
visibility: hidden;
}
#main li:nth-of-type(3n):before,
#main li:nth-of-type(5n):before,
#main li:nth-of-type(15n):before{
visibility: visible;
display: inline;
}
#main li:nth-of-type(3n):before{
content:"Fizz";
}
#main li:nth-of-type(5n):before{
content:"Buzz";
}
#main li:nth-of-type(15n):before{
content:"FizzBuzz";
}
@mogya
Copy link
Author

mogya commented Feb 7, 2014

とりあえず要件を満たすところまでで。
3,5とかよりも、数字を隠してFizzBuzzを表示させるほうがよっぽどたいへんw

@mogya
Copy link
Author

mogya commented Feb 7, 2014

afterじゃなくてbeforeを使うと見た目がよくなりますね。
beforeとafterを組み合わせると15nが不要になるのですが、見た目がアレなのでこっちにしました。

@monsat
Copy link

monsat commented Feb 18, 2014

今気づきました。回答ありがとうございますー。これから下記の記事に追記しますね。
http://monsat.hatenablog.com/entry/2014/02/18/css-fizz-buzz-answers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment