How to calculate percentages in LESS CSS?

前端 未结 2 1329
太阳男子
太阳男子 2020-12-13 00:29

I would like to calculate the width of child-container (div etc) in percentages depending on the parent container with LESS CSS.

I am using the forumula by Ethan Mar

2条回答
  •  遥遥无期
    2020-12-13 01:22

    Maybe the percentage function didn't exist when OP was asking but for future reference I add this answer.

    div.child-container {
        width: percentage(140/620);
    }
    

提交回复
热议问题