Sass digital function


Release date:2024-02-29 Update date:2024-02-29 Editor:admin View counts:47

Label:

Sass digital function

The Sass numeric function is used to process some numeric values.

The following table lists the numeric functions of Sass:

Function

Description & example

abs(number)

Returns the absolute value of a numeric value.

Example: abs (15) result: 15 abs (- 15) result: 15

ceil(number)

Rounding up

Example: ceil. Result: 16.

comparable(num1, num2)

Returns a Boolean value to determine whether num1 and num2 can be compared

Example: comparable (15px, 10px) result: true comparable (20mm, 1cm) result: true comparable (35px, 2em) result: false

floor(number)

Round down

Example: floor (15.80) result: 15

max(number...)

Return the maximum value

Example: max (5, 7, 9, 0,-3,-7) result: 9

min(number...)

Return to the minimum

Example: min (5,7,9,0,-3,-7) result:-7

percentage(number)

Convert a number into an expression of a percentage.

Example: percentage (1.2) result: 120

random()

Returns the decimal within the 0-1 interval

Example: random () result: 0.45673

random(number)

Returns an integer between 1 and number, including 1 and limit.

Example: random (6) result: 4

round(number)

Returns the integer closest to that number, rounded.

Example: round. Result: 15 round. Result: 16.

Powered by TorCMS (https://github.com/bukun/TorCMS).