Is it possible to use vh minus pixels in a CSS cal

2019-01-21 08:32发布

This question already has an answer here:

I have following CSS rule in a Less file:

.container {
  min-height: calc(100vh - 150px);
}

Which doesn't work at all. I want to make container full window height and minus header, footer fixed height. How can I do that?

标签: css less
1条回答
倾城 Initia
2楼-- · 2019-01-21 09:04

It does work indeed. Issue was with my less compiler. It was compiled in to:

.container {
  min-height: calc(-51vh);
}

Fixed with the following code in less file:

.container {
  min-height: calc(~"100vh - 150px");
}

Thanks to this link: Less Aggressive Compilation with CSS3 calc

查看更多
登录 后发表回答