Skip to content

Instantly share code, notes, and snippets.

@srsgores
Last active December 11, 2015 09:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save srsgores/4583645 to your computer and use it in GitHub Desktop.
Save srsgores/4583645 to your computer and use it in GitHub Desktop.
less recursive headers
@em: 1em;
@multiplierLarge: 2.3;
@multiplier: 2;
.headingsX(@index) when (@index > 0) {
(~"h@{index}") {
font-size: ((@em * @multiplierLarge) - ((@index * ((@em * @multiplierLarge) / 6 )))) + (@em * @multiplier);
}
.headingsX(@index - 1);
}
.headingsX(0) {}
.headingsX(6);
@srsgores
Copy link
Author

Example output:

h6 {
  font-size: 1.3em;
}
h5 {
  font-size: 1.7550000000000001em;
}
h4 {
  font-size: 2.21em;
}
h3 {
  font-size: 2.665em;
}
h2 {
  font-size: 3.12em;
}
h1 {
  font-size: 3.575em;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment