Language Features
- Less - Parent Selectors
- Less - Merge
- Less - Loops
- Less - CSS Guards
- Less - Mixin Guards
- Less - Import Options
- Less - Import Directives
- Less - Passing Rulesets to Mixins
- Less - Mixins as Functions
- Less - Parametric Mixins
- Less - Mixins
- Less - Extend
- Less - Variables
- Less - Importing
- Less - Comments
- Less - Scope
- Less - Namespaces and Accessors
- Less - Functions
- Less - Escaping
- Less - Operations
- Less - Nested Directives and Bubbling
- Less - Nested Rules
Functions
- Less - Color Blending Functions
- Less - Color Operation
- Less - Color Channel Functions
- Less - Color Defination Functions
- Less - Type Functions
- Less - Math Functions
- Less - List Functions
- Less - String Functions
- Less - Misc Functions
Usage
- Less - Frameworks
- Less - Third Party Compilers
- Less - Editors and Plugins
- Less - GUIs
- Less - Online Compilers
- Less - Programmatic Usage
- Less - Plugins
- Less - Browser support
- Using Less In The Browser
- Less - Command Line Usage
Less Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
LESS - Math Functions
Description
Math functions includes methods which are used for performing numeric operations such as round, square root, power value, modulus, percentage, etc.
Following table shows Math Functions used in LESS −
Sr.No. | Function & Description | Example |
---|---|---|
1 | ceil It rounds up the number to next highest integer. |
ceil(0.7) it round the number to − 1 |
2 | floor It rounds down the number to next lowest integer. |
floor(3.3) it round the number to − 3 |
3 | percentage It transforms the floating point number to percentage string. |
percentage(0.2) it converts the number to percentage string as − 20% |
4 | round It rounds a floating point number. |
round(3.77) it converts the number to the rounding value as − 4 |
5 | sqrt It returns the square root of a number. |
sqrt(25) it defines the square root of a number as − 5 |
6 | abs It provides the absolute value of a number. |
abs(30ft) it displays the absolute value as − 30ft |
7 | sin It returns radians on numbers. |
sin(2) it calculates the sine value as − 0.90929742682 |
8 | asin It specifies arcsine (inverse of sine) of a number which returns value between -pi/2 and pi/2. |
asin(1) it calculates the asin value as − 1.5707963267948966 |
9 | cos It returns cosine of the specified value and determines radians on numbers without units. |
cos(2) it calculates the cos value as − -0.4161468365471424 |
10 | acos It specifies arccosine (inverse of cosine) of a number which returns value between 0 and pi. |
acos(1) it calculates the acos value as − 0 |
11 | tan It specifies tangent of the number. |
tan(60) it calculates the tan value as − 0.320040389379563 |
12 | atan It specifies arctangent (inverse of tangent) of a specified number. |
atan(1) it displays atan value as − 0.7853981633974483 |
13 | pi It returns the pi value. |
pi() it determines the pi value as − 3.141592653589793 |
14 | pow It specifies the value of first argument raised to the power of second argument. |
pow(3,3) it specifies the power value as − 27 |
15 | mod It returns modulus of first argument with respect to the second argument. It also handles negative and floating point numbers. |
mod(7,3) it returns the modulus value as − 1 |
16 | min It specifies the smallest value of one or more arguments. |
min(70,30,45,20) it returns the minimum value as − 20 |
17 | max It specifies the highest value of one or more arguments. |
max(70,30,45,20) it returns the maximum value as − 70 |