在CSS calc()中可以使用vh minus像素? [英] It is possible to use vh minus pixels in a CSS calc()?

查看:201
本文介绍了在CSS calc()中可以使用vh minus像素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在以下文件中有以下CSS规则:

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?

推荐答案

它确实工作。问题是我少编译器。它编译到:

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");
}


$ b $ p

感谢这个链接:使用CSS3计算减少主动编译

这篇关于在CSS calc()中可以使用vh minus像素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆