Created
October 17, 2014 09:28
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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