YouTip LogoYouTip

Sass Numeric Func

# Sass Numeric Functions [![Image 3: Sass Functions](#) Sass Functions](#) Sass numeric functions are used to handle numerical values. The following table lists Sass's numeric functions: | Function | Description & Example | | --- | --- | | abs(_number_) | Returns the absolute value of a number. **Example:** abs(15) Result: 15 abs(-15) Result: 15 | | ceil(_number_) | Rounds a number up to the next highest whole number. **Example:** ceil(15.20) Result: 16 | | comparable(_num1_, _num2_) | Returns a boolean value indicating whether _num1_ and _num2_ are comparable. **Example:** comparable(15px, 10px) Result: true comparable(20mm, 1cm) Result: true comparable(35px, 2em) Result: false | | floor(_number_) | Rounds a number down to the next lowest whole number. **Example:** floor(15.80) Result: 15 | | max(_number..._) | Returns the highest value in a list of one or more numbers. **Example:** max(5, 7, 9, 0, -3, -7) Result: 9 | | min(_number..._) | Returns the lowest value in a list of one or more numbers. **Example:** min(5, 7, 9, 0, -3, -7) Result: -7 | | percentage(_number_) | Converts a unitless number to a percentage. **Example:** percentage(1.2) Result: 120 | | random() | Returns a random decimal number between 0 and 1. **Example:** random() Result: 0.45673 | | random(_number_) | Returns a random integer between 1 and the specified number, inclusive. **Example:** random(6) Result: 4 | | round(_number_) | Returns the closest integer to a number, rounding up or down as needed. **Example:** round(15.20) Result: 15 round(15.80) Result: 16 | * * Sass Functions](#)
← Ng Ng KeydownNg Ng Href β†’