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

#168973
Alen
Participant

// Variables
$h1: 22px;
$h2: 20px;
$h3: 18px;
$h4: 16px;
$h5: 14px;
$h6: 12px;
// List of headings
$headings: ( h1: $h1, h2: $h2, h3: $h3, h4: $h4, h5: $h5, h6: $h6 );
// Loop over list of headings
// @each ( $heading : $size )
@each $heading, $size in $headings {
    #{$heading} {
        margin: 10px 0;
        line-height: 1.5em;
        font-size: $size;
    }
}