Skip to content

Instantly share code, notes, and snippets.

@seven-phases-max
Created May 16, 2017 19:27
Show Gist options
  • Save seven-phases-max/379de5a4e4b4185b8ae798ad2dd4829a to your computer and use it in GitHub Desktop.
Save seven-phases-max/379de5a4e4b4185b8ae798ad2dd4829a to your computer and use it in GitHub Desktop.
// example for http://stackoverflow.com/questions/44007852
@font-base: 16;
@font-scale: 1.2;
@line-height: 1.5;
// ............................................
@tags: h1, h2, h3, h4, p;
@margin-scale: 2, 1, 0, 0, 0;
.for-each(@tag, @i in @tags) {
@{tag} {
.font(@tag);
.font-rythm(@i);
}
}
// ............................................
.font(@tag) when (default()) {
font-family: sans-serif;
font-weight: bolder;
}
.font(p) {
font-family: serif, monospace;
font-weight: normal;
}
.font-rythm(@i) {
@fs: pow(@font-scale, 5 - @i);
font-size: @font-base * @fs * 1px;
margin-bottom: @line-height / @fs
* at(@margin-scale, @i) * 1em;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment