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

前端 未结 2 1740
星月不相逢
星月不相逢 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: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)
    

提交回复
热议问题