[英]How to make image fit window height?
I'd like to set an image to match the height of my page minus top menu (50px). 我想将图片设置为与页面高度减去顶部菜单(50像素)相匹配。 Also, I'm using twitter bootstrap 3
and I know it's got img-responsive
class, which is great and I'd like to use this class in combination with making the image height=100%-50px
. 另外,我使用的是twitter bootstrap 3
,我知道它具有img-responsive
类,这很棒,我想结合使用此类,使图像height=100%-50px
。
How can I do that? 我怎样才能做到这一点?
If you want combine percents with pixel you can use css3 property calc(): 如果要将百分比与像素合并,可以使用css3属性calc():
height: calc(100% - 50px);
Supported by IE9+ IE9 +支持
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.