css - 图像 div 设置为高度 : 100% but not expanding to 100% - trying to avoid 100vh

标签 css

我的图像 div 没有扩展到 height: 100% 时遇到问题。

htmlbodywrapper 设置为 height: 100%

下面的代码是我目前使用的:

.blogimgcont {
width: 100%;
height: 100%;
}

.blogimgcont img{
height: 100%;
width: 100%;
}

100vh 确实会使图像占据整个垂直高度,但我担心使用它会遇到跨浏览器兼容性问题。

谁能指出为什么 height: 100% 不起作用?

请查看http://protein.guru/澄清

编辑:

我还是决定使用 100vh - 谢谢你的回答

最佳答案

试试这个

.blogimgcont {
    width: 100%;
    height: 100%;
    position: relative;
    top: 0;
    bottom: 0;
}

关于css - 图像 div 设置为高度 : 100% but not expanding to 100% - trying to avoid 100vh,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34752252/

相关文章:

javascript - 禁用滚动、动画,然后再次启用滚动

javascript - 我现有的代码是 javascript,我想在 jquery 中转换它们?

html - 没有 div 的 Wordpress Contact Form 7 复选框的 CSS

javascript - jQuery sortables - 连接问题

css - 这个网站是如何加载背景图片的

php - css如何增加带有不同文本的圆形图像按钮的大小

css - 由于 UI 主题类,jqGrid zebra/alt 行背景不工作

html - 外框为黑色但内框为灰色的表格

html - v4 bootstrap 全高侧边栏

css - 如何向 HTML5 表格添加滚动条?