”工欲善其事,必先利其器。“—孔子《论语.录灵公》
首页 > 编程 > 对象拟合:IE和Edge中的封面失败,如何修复?

对象拟合:IE和Edge中的封面失败,如何修复?

发布于2025-06-16
浏览:237

Object-Fit: Cover Fails in IE and Edge, How to Fix?

To resolve this issue, we employ a clever CSS solution that solves the problem:

position: absolute;

top: 50%;

left: 50%;

transform: translate(-50%, -50%);

高度:auto;

宽度:100%; //对于水平块
,使用绝对定位将图像定位在中心,以object-fit:cover in IE和Edge消除了问题。 The image will now scale proportionally, maintaining the desired effect without distortion.

To illustrate the solution's effectiveness, consider the following demonstration:


Image Resizing Demonstration

This approach ensures consistent image behavior across all browsers, effectively addressing the object-fit: cover issue in IE and Edge.

最新教程 更多>

免责声明: 提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发到邮箱:[email protected] 我们会第一时间内为您处理。

Copyright© 2022 湘ICP备2022001581号-3