Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSS

mapping and each in sass

$font-sizes: (
  900: 3rem,
  700: 1.5rem,
  400: 1.125rem,
);

@each $shade, $value in $font-sizes {
  .fs-#{$shade} {
    font-size: $value;
  }
}

/* 
Compiled CSS: 
.fs-900 { font-size: 1.125rem }
.fs-700 { font-size: 1.5rem }
.fs-400 { font-size: 3rem }
*/
 
PREVIOUS NEXT
Tagged: #mapping #sass
ADD COMMENT
Topic
Name
3+3 =