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


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

For example:




Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA