用引导响应图像约束图像高度? [英] Constraining image height with bootstrap responsive image?

查看:100
本文介绍了用引导响应图像约束图像高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用bootstrap在网站上工作,在项目组合部分,项目的图像可以响应:

 'class' => 'img-responsive'

它适用于横向图像,纵向图像被放大到适合宽度明智的,但太高了,有没有办法检查肖像定向的图像,只适用于它的固定高度600px? 解决方案

如果容器应该有一个固定的高度,然后给它一个ID(或一个类),并改变.img响应的限制,例如

  .container {
height:600px;
}


/ *然后更改* /
.container .img-responsive {
display:block;
height:auto;
最大宽度:100%;
}
/ *至* /

.container .img-responsive {
display:block;
width:auto;
最大高度:100%;
}

不知道如何使用混合的方向,但是如果它们是浮动的它应该真的很重要


Working on a site using bootstrap, in the portfolio section, the images of projects are responsive with :

'class' => 'img-responsive'

It works great for landscape images, the portrait images are blown up to fit width wise, but are too tall, is there a way to check for a portrait orientated image and just apply a fixed height of 600px for it?

解决方案

If the container should have a fixed height, then give it an ID (or a class) and change the .img-responsive restrictions the other way around eg

.container {
height: 600px;
}


/*And then change */
  .container .img-responsive {
    display: block;
    height: auto;
    max-width: 100%;
}  
/*To */

.container  .img-responsive {
    display: block;
    width: auto;
    max-height: 100%;
}

Not sure how it will work with a mix of orientations but if they are floated it shouldnt really matter

这篇关于用引导响应图像约束图像高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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