Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not work @for and nth-child #1601

Closed
6pm opened this issue Jan 17, 2015 · 3 comments
Closed

Not work @for and nth-child #1601

6pm opened this issue Jan 17, 2015 · 3 comments

Comments

@6pm
Copy link

6pm commented Jan 17, 2015

Code:
// vars
$linkColor1: #ccc;
$linkColor2: #ddd;
$linkColor3: #aaa;
// for
@for $i from 1 through 3 {
&:nth-child(3n+{$i}){
color: $linkColor{$i};
}
}

@cimmanon
Copy link

It isn't supposed to work. Duplicate of #132

@KittyGiraudel
Copy link

Dynamic variables do not exist. Maps are to be used instead.

@chriseppstein
Copy link

You don't even need maps for this example, a list will suffice.

// vars
$linkColors: #ccc, #ddd, #aaa;

// for
.something {
  @for $i from 1 through length($linkColors) {
    &:nth-child(3n+#{$i}) {
      color: nth($linkColors, $i);
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants