-
-
Save king-panda/b328394611a7e28f4eb3 to your computer and use it in GitHub Desktop.
【Sass】配列を@each文でリストとして出力 ref: http://qiita.com/kingpanda/items/f63a536ab76ba9f2f507
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
ul li:nth-child(1):before {content: "Curtis Wilbur";} | |
ul li:nth-child(2):before {content: "John S McCain";} | |
ul li:nth-child(3):before {content: "Fitzgerald";} | |
ul li:nth-child(4):before {content: "Lassen";} | |
ul li:nth-child(5):before {content: "McCampbell";} | |
ul li:nth-child(6):before {content: "Mustin";} | |
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
・Curtis Wilbur | |
・John S McCain | |
・Fitzgerald | |
・Lassen | |
・McCampbell | |
・Mustin | |
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
// 配列 | |
$values: Curtis Wilbur, John S McCain, Fitzgerald, Lassen, McCampbell, Mustin; | |
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
$key: index($values, $value); | |
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
nth($values, $index_key) | |
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
<ul> | |
<li></li> | |
<li></li> | |
<li></li> | |
<li></li> | |
<li></li> | |
<li></li> | |
</ul> | |
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
ul{ | |
@each $value in $values { | |
$key: index($values, $value); | |
li:nth-child(#{$key}):before{ | |
content: '#{nth($values, $key)}'; | |
} | |
} | |
} | |
// 配列 | |
$values: Curtis Wilbur, John S McCain, Fitzgerald, Lassen, McCampbell, Mustin; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment