Skip to content

Instantly share code, notes, and snippets.

@nckcol
Last active November 12, 2016 20:18
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 nckcol/748b8ea8ae4bcfe0a6b3f0978d717ec7 to your computer and use it in GitHub Desktop.
Save nckcol/748b8ea8ae4bcfe0a6b3f0978d717ec7 to your computer and use it in GitHub Desktop.
SCSS function for css lock https://fvsch.com/code/css-locks/
@function lock($min_value /* em */, $max_value /* em */, $min_width /* em */, $max_width /* em */) {
@return calc(
#{$min_value}
+ (#{$max_value/1em} - #{$min_value/1em})
* (100vw - #{$min_width})
/ (#{$max_width/1em} - #{$min_width/1em})
);
}
// CodePen Sample http://codepen.io/nckcol/pen/aBNJXP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment