xxxxxxxxxx
// Define a Sass function
@function calculate-rem($px-value) {
@return $px-value / 16px * 1rem;
}
// Use the function in a style rule
body {
font-size: calculate-rem(16px);
}
xxxxxxxxxx
/* How to declare a function: */
@function some-func($param) {
@return (100/$param);
}
/* How to use a function: */
.col-6 { font-size: some-func(5);}
/* The above is the same as: */
.col-6 { font-size: 20; }