Skip to content

Instantly share code, notes, and snippets.

@zanonnicola
Created October 17, 2014 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zanonnicola/9bb2616e3cccbd9ea0a8 to your computer and use it in GitHub Desktop.
Save zanonnicola/9bb2616e3cccbd9ea0a8 to your computer and use it in GitHub Desktop.
Contextual heading sizes with Sass Sass maps make it possible to create congruous, contextual CSS. As an an example, let's look at heading sizes.
/* Create a step size.*/
/* This is the percentage each heading will be reduced by. */
$step-size-heading: 0.33333;
/* The mixin */
@mixin heading-size($size) {
font-size: $size * $step-size-heading + em;
}
h1 {
@include heading-size(6);
}
h2 {
@include heading-size(5);
}
h3 {
@include heading-size(4);
}
h4 {
@include heading-size(3);
}
h5 {
@include heading-size(2);
}
h6 {
@include heading-size(1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment