Getting percentages to work in CSS calc() for Firefox and Safari?

后端 未结 3 1227
难免孤独
难免孤独 2021-02-14 02:53

I\'m using the following calc() equation to calculate the width of two divs:

CSS

.MyClass {
    width: calc((100% - 800px) / 2);
    wid         


        
3条回答
  •  萌比男神i
    2021-02-14 03:43

    Eureka. I've been struggeling with this for days. Finally found that 100vh instead off 100% would make it work with most browsers.

    height: calc(100vh - 100px);
    

    instead of

    height: calc(100% - 100px);
    

    Finally, now I can get on with my project.

提交回复
热议问题