daily pastebin goal
45%
SHARE
TWEET

Untitled

a guest Mar 26th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ----
  2. // Sass (v3.4.25)
  3. // Compass (v1.0.3)
  4. // ----
  5.  
  6. /**
  7.  * Convert font-size from px to rem with px fallback
  8.  *
  9.  * @param $size - the value in pixel you want to convert
  10.  *
  11.  * e.g. p {@include fontSize(12px);}
  12.  *
  13.  */
  14.  
  15. $basefontsize: 18px;
  16.  
  17. // Function for converting a px based font-size to rem.
  18. @function calculateRem($size) {
  19.   $remSize: $size / $basefontsize;
  20. //Default font size on html element is 100%, equivalent to 16px;
  21.   @return #{$remSize}rem;
  22. }
  23.  
  24. // Mixin that will include the fall back px declaration as well as the calculated rem value.
  25. @mixin fontSize($size) {
  26.   font-size: $size;
  27.   font-size: calculateRem($size);
  28. }
  29.  
  30.  
  31. h1 {
  32.   @include fontSize(50px);
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top