Javatpoint Logo
Javatpoint Logo

Less convert()

The Less convert function is used to convert number from one unit to another. It contains two arguments; first argument passes number along with unit and second argument contains units. The number is converted when the unit is compatible.

If the first argument is unchanged then the unit is not compatible.

Let's take an example to demonstrate the usage of convert function in Less.

Create a Less file named "simple.less", having the following data.

Less file: simple.less

Now, execute the following code: lessc simple.less simple.css

Less-convert-function1"/

This will compile the "simple.less" file. A CSS file named "simple.css" will be generated.

For example:

Less-convert-function2"/

Output:

Less-convert-function3"/



Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA