Skip to content

Instantly share code, notes, and snippets.

@stefsullrew
Created December 22, 2014 15:52
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 stefsullrew/9e4ce09153d7f6020a1c to your computer and use it in GitHub Desktop.
Save stefsullrew/9e4ce09153d7f6020a1c to your computer and use it in GitHub Desktop.
Sass vs Less - context function
@function calc-em($target-px, $context) {
@return ($target-px / $context) * 1em;
}
@typeoneerror
Copy link

.calc-em(@target, @context) {
  @calc-em-value: (@target / @context) * 1em;
}

div {
  .calc-em(42, 16);
  font-size: @calc-em-value;
}

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