隐藏画廊幻灯片中的额外图像
我试图部分隐藏这些图像。在此示例中,您可以看到“四”和“五”图像超出了列表,因此我需要隐藏不应该可见的部分。
这是正在发生的事情: Codepen 示例
HTML 代码:
<div class="gallery-row">
<ul class="list">
<div class="list__item">
<img class="list__thumbnail" src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/3f/NYCS-bull-trans-1.svg/1024px-NYCS-bull-trans-1.svg.png">
</div>
//and four more images below
</ul>
</div>
SASS 代码:
.gallery-row {
width: 800px;
background-color: blue;
.list {
display: flex;
gap: 20px;
list-style: none;
width: 100%;
.list__item {
min-width: 220px;
height: 220px;
.list__thumbnail {
width: 100%;
height: 100%;
}
}
}
}
I'm trying to partially hide these images. In this example you can see that the "four" and "five" images are exceeding the list so i need to hide the parts that shouldn't be visible.
Here is what is happening:
Codepen example
And here is what i'm trying to do:
HTML code:
<div class="gallery-row">
<ul class="list">
<div class="list__item">
<img class="list__thumbnail" src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/3f/NYCS-bull-trans-1.svg/1024px-NYCS-bull-trans-1.svg.png">
</div>
//and four more images below
</ul>
</div>
SASS code:
.gallery-row {
width: 800px;
background-color: blue;
.list {
display: flex;
gap: 20px;
list-style: none;
width: 100%;
.list__item {
min-width: 220px;
height: 220px;
.list__thumbnail {
width: 100%;
height: 100%;
}
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
经过进一步调查,我可以找到一个解决方案,只需在“gallery-row”div 标签中添加
overflow: hide
即可。After further investigation i could find a solution just adding
overflow: hidden
in "gallery-row" div tag.将隐藏的溢出添加到您的
.gallery-row
类中。这是达到相同效果的更简单的实现
Add an overflow of hidden to your
.gallery-row
class.Here is a simpler implementation for the same effect
只需将此代码添加到您的 .gallery-row 中即可。
Just add this code in your .gallery-row.