Last active
August 29, 2015 13:56
-
-
Save mogya/8860493 to your computer and use it in GitHub Desktop.
Re:どうしてwebデザイナーに・・・CSSが書けないのか?
This file contains 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
#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"; | |
} |
afterじゃなくてbeforeを使うと見た目がよくなりますね。
beforeとafterを組み合わせると15nが不要になるのですが、見た目がアレなのでこっちにしました。
今気づきました。回答ありがとうございますー。これから下記の記事に追記しますね。
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
とりあえず要件を満たすところまでで。
3,5とかよりも、数字を隠してFizzBuzzを表示させるほうがよっぽどたいへんw