简体   繁体   中英

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). 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 .

How can I do that?

If you want combine percents with pixel you can use css3 property calc():

height: calc(100% - 50px);

Supported by IE9+

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM