【发布时间】:2018-10-29 14:12:52
【问题描述】:
我有一个带有产品信息的引导模式。在该模式上是一个额外的图像部分,需要水平滚动。我已经让它工作了,但我必须发送一个固定的宽度。无论如何我可以使这个绝对 div 适合内容宽度而不会将图像放到新行吗?
<div class="additional-images-container">
<div>
<img width="100px" height="100px" src="">
<img width="100px" height="100px" src="">
<img width="100px" height="100px" src="">
<img width="100px" height="100px" src="">
<img width="100px" height="100px" src="">
<img width="100px" height="100px" src="">
<img width="100px" height="100px" src="">
<img width="100px" height="100px" src="">
</div>
</div>
.additional-images-container {
height: 120px;
overflow-x: scroll;
position: relative;
}
.additional-images-container div {
position: absolute;
width: 200%;
}
再次,我需要子 div 自动调整其宽度并用水平滚动条溢出父级(在需要时)。顺便说一句,我不能使用 jQuery 来做到这一点。
【问题讨论】: