html - 如何使图像适合窗口高度?

标签 html css twitter-bootstrap responsive-design fluid-layout

我想设置一个图像以匹配我的页面减去顶部菜单的高度 (50px)。另外,我正在使用 twitter bootstrap 3,我知道它有 img-responsive 类,这很棒,我想结合使用这个类来制作图片 height=100%-50px

我该怎么做?

最佳答案

如果你想将百分比与像素结合起来,你可以使用 css3 属性 calc():

height: calc(100% - 50px);

IE9+支持

关于html - 如何使图像适合窗口高度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20621759/

相关文章:

jquery - 如何在单击时将两个不同的事件类添加到两个不同的选项卡(它在图像上的外观)

php - 如何在 WordPress 中显示来自 get_children 数组的特定图像

html - 在 Bootstrap 4 Alpha 6 中对齐表单?

javascript - 如何在不使用 AngularJs 的 ng-repeat 的情况下创建并从下拉菜单(Bootstrap)中选择一个元素

css - 在 wordpress 主题中找不到父元素

javascript - 选择时更改下拉菜单的背景颜色

php - 在单个请求中组合 CSS

css - :not selector does not work for nested elements

javascript - Bootstrap datetimepicker 在 document.ready 中使用时不是函数

html - 如何在 html5 表单的 css3 中应用媒体查询