K
K
karakushan2015-12-07 11:58:46
Less
karakushan, 2015-12-07 11:58:46

How to convert pixels to percentages in Less?

At first, the site template was fixed, then it had to be converted to adaptive. Many elements on the site have absolute positioning. We urgently need a formula to convert from pixels to percentages.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
karakushan, 2015-12-07
@karakushan

What was needed was a formula, not a principle of calculation. Created it myself.

@base:1920;
/* Формула для перевода пикселей в проценты */
.pxtp( @pixel:@base ) {
  @return: @pixel /@base  * 100%+0px;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question