Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other SCSS, Using a variable in @each loop Reply To: SCSS, Using a variable in @each loop

#168975
maikelkoopman
Participant

Thanks, Allen. I noticed this works only for Sass 3.3.
I just found a way for sass 3.2 (since I am using compass). It is less pretty but it works:

// headings
  #{headings()} {
    margin: 10px 0;
    line-height: 1.5em;
  }

  $headings: h1, h2, h3, h4, h5, h6;
  $size: $h1, $h2, $h3, $h4, $h5, $h6;

  $head-size: zip($headings, $size);

  @each $a in $head-size {
    #{nth($a, 1)} {
      font-size: nth($a, 2);
    }
  }