html - IE11 中图像的 CSS 问题中心和“最大宽度”
问题描述
我有一个基本的图像拇指,可以在 Firefox/Chrome 中正常工作,但在 IE11 中不起作用。
形象max-width
不受尊重,照原样大放异彩。
.thumb {
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
font: 0/0 a;
height: 4.5rem;
width: 4.5rem;
padding: 0.25rem;
border: 1px solid #9E9E9E;
border-radius: 0.1875rem;
box-shadow: 0 1px 6px #BDBDBD;
cursor: pointer;
margin: 0 0.5rem 0 0;
text-align: center;
}
.thumb img {
display: inline-block;
max-height: 90%;
max-width: 90%;
}
<div class="thumb" >
<img src="https://via.placeholder.com/250x90">
</div>
解决方案
尝试添加:min-width:1px;
到您的图像。这是 IE 的一个已知错误。
.thumb {
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
font: 0/0 a;
height: 4.5rem;
width: 4.5rem;
padding: 0.25rem;
border: 1px solid #9E9E9E;
border-radius: 0.1875rem;
box-shadow: 0 1px 6px #BDBDBD;
cursor: pointer;
margin: 0 0.5rem 0 0;
text-align: center;
}
.thumb img {
display: inline-block;
max-height: 90%;
max-width: 90%;
min-width:1px;
}
<div class="thumb" >
<img src="https://via.placeholder.com/250x90">
</div>
推荐阅读
- java - 登录后出现 JavaNullPointerException
- python - 在 pandas 中解码为 UTF-8
- vsphere - vSphere Management SDK Java 中的分页和速率限制方面
- r - 如何阻止 Rd2pdf 将路径名打印到 man 目录
- collision - 球对球碰撞检测
- java - 使用 Firebase 电话身份验证验证 OTP 后应用程序崩溃
- python - 在 Python 中填充缺失值
- android - 更改 Google 工作区中的电子邮件对 Firebase 身份验证身份的影响
- typescript - 如何使用 QueryBuilder 在 Nest.js 中将数据查询到多个表中
- java - 一个 groovy 字符串也隐含地是一个集合吗?