height: calc(100%) not working correctly in CSS

后端 未结 7 970
面向向阳花
面向向阳花 2020-12-02 15:09

I have a div that I want to fill the whole height of the body less a set number in pixels. But I can\'t get height: calc(100% - 50px) to work.

The reas

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-02 16:02

    If you are styling calc in a GWT project, its parser might not parse calc for you as it did not for me... the solution is to wrap it in a css literal like this:

    height: literal("-moz-calc(100% - (20px + 30px))");
    height: literal("-webkit-calc(100% - (20px + 30px))");
    height: literal("calc(100% - (20px + 30px))");
    

提交回复
热议问题