图像溢出设置为隐藏,但仍然无法工作



我有一个图像,即使它的父级设置为overflow: hidden,它仍然溢出并在页面上创建水平滚动。此处显示

以下是相关代码:

.section2img {
overflow-x: hidden !important;
height: min-content;
position: relative;
width: 50vw;
right: -60%;
top: 0;
}
.section2 img {
position: relative;
overflow-x: hidden !important;
}
GitRepo(如果需要(

所以你可以做的是设置img的宽度,使其与网站匹配,然后将object-fit: cover;添加到img中,它所做的就是剪切溢出的部分。

最新更新