Can numbers be rounded (math term) using LESS CSS?

前端 未结 2 1718
星月不相逢
星月不相逢 2021-01-01 19:16

LESS CSS = http://lesscss.org/

I declared a variable, like this... @height: 30px

Then I used a simple calculation, like this... line-heigh

相关标签:
2条回答
  • 2021-01-01 19:39

    http://lesscss.org/functions/ for a list of the lesscss functions, floor is included under the heading "Math functions".

    0 讨论(0)
  • 2021-01-01 19:52

    Yes they can:

    line-height: ceil(@height * .666);      // 20px (round up)
    line-height: floor(@height * .666);    // 19px (round down)
    line-height: round(@height * .666);     // 20px (round to closest integer)
    line-height: round(@height * .666, 1);  // 20.0px (round to 1 decimal place)
    
    0 讨论(0)
提交回复
热议问题