Skip to content

Instantly share code, notes, and snippets.

@Gerhut
Created December 29, 2014 06:56
Show Gist options
  • Select an option

  • Save Gerhut/151caf876c1f84391c10 to your computer and use it in GitHub Desktop.

Select an option

Save Gerhut/151caf876c1f84391c10 to your computer and use it in GitHub Desktop.
给属性附加循环列表值
values(property, values)
length = length(values)
for value, index in values
&:nth-child({length}n + {index})
{unquote(property)} value
/* li
* values(background-color, #8185cd #7cd7c5 #65adeb #ee8e69)
*
* yields
*
* li:nth-child(4n + 0) {
* background-color: #8185cd;
* }
* li:nth-child(4n + 1) {
* background-color: #7cd7c5;
* }
* li:nth-child(4n + 2) {
* background-color: #65adeb;
* }
* li:nth-child(4n + 3) {
* background-color: #ee8e69;
* }
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment