html - 如何防止我的图像缩小

标签 html css

当我从左到右或从上到下缩小浏览器窗口时,图像的宽高比会发生变化。我试图为我的图像提供一个以像素为单位的高度,但这样做时,图像隐藏了我的“h3”句子。

这是我的密码笔:A tribute page - project

这是我的代码的一部分:

    header {
  height: 100%;
  width: 100%;
}

    .container-fluid {
  height: 100%;
  padding: 0;
}

 .row {
  height: 100%;
}


#image {
  display: flex;
  flex-flow: row, wrap;
  position: relative;
  width: 100%;
  height: 100%;
  margin-left: auto;
  margin-right: auto;
  border-bottom: 1px solid #ed1c24;
}

最佳答案

尝试添加到 #image 规则 object-fit: cover 但此解决方案在 IE 中不起作用。对于 IE,您需要找到一个 Polyfill。

关于html - 如何防止我的图像缩小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50309319/

相关文章:

html - 如何添加一个将 TextArea 移动到页面顶部的类?

html - Stepper 纯 HTML CSS

html - CSS3 - 为什么我的转换不起作用?

html - 尝试使用基础将 VCard 与名称文本字段对齐

html - 制作此布局(CSS 或表格)的最佳方式是什么?

html - 在 HTML/XHTML TextArea 中对齐文本

html - 如何在 CSS 中使用 SPAN 创建列?

html - webkit 关键帧在最小化时中断

html - div 中的图像不会更改大小以适应不同尺寸的屏幕

javascript - CSS3 重置动画需要超时(如果从外部样式表设置动画)