Lightweight CSS Framework for Building Apps and Websites https://crispy-css.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
908 B

7 years ago
  1. $base__font-size: 16px !default;
  2. $base__line-height: 1.5 !default;
  3. /**
  4. * calculate pixel value to em
  5. *
  6. * @param {px} $font-size
  7. * @return {em}
  8. */
  9. @function pxToEm($font-size) {
  10. @return ($font-size / $base__font-size) * 1em;
  11. }
  12. /**
  13. * calculate px value to rem
  14. *
  15. * @param {px} $px
  16. * @param {px} $font-size
  17. * @return {em}
  18. */
  19. @function pxToRem($font-size) {
  20. @return ($font-size / $base__font-size) * 1rem;
  21. }
  22. /**
  23. * calculate em value to rem
  24. *
  25. * @param {em} $value
  26. * @param {px} $font-size
  27. * @return {px}
  28. */
  29. @function emToPx($value, $font-size: $base__font-size) {
  30. @return ($value * $font-size) * 1px;
  31. }
  32. /**
  33. * calculate line-height with font-size
  34. *
  35. * @param {px} $font-size
  36. * @param {unitless} $base-line-height
  37. * @return {unitless}
  38. */
  39. @function lineHeight($font-size, $line-height: $base-line-height) {
  40. @return unitless(emToPx($line-height * 1em) / $font-size);
  41. }