【发布时间】:2016-08-06 03:32:31
【问题描述】:
我正在尝试将多个 div(图像 -> 黑色块)放入一个容器(图像 -> 蓝色块)中。我需要在容器中放置尽可能多的 div。容器有一个“浮动”宽度,所以它在每个屏幕上都有不同的大小。 “1”(在图片中)代表我今天拥有的东西,它正在工作。
问题是我在整个站点中使用引导弹出窗口,但容器中的溢出不允许它出现。如果我删除溢出属性(图像中的“2”),所有 div 都会出现在“下”行中。我不想滚动,只是隐藏不适合容器的 div。
图中的“3”代表我想要的。
这是我的代码:
// CSS
.content-bar{
max-width:100%;
height: 3.5em;
white-space:nowrap;
display: inline-block;
overflow-x: hidden;
overflow-y: visible;
}
.photo-bar{
width: 2.5em;
height: 3.5em;
margin-right: -.55em;
padding: 0;
display: inline-block;
white-space: normal;
}
// JS
<div class="content-bar">
<div class="photo-bar" ng-repeat="...">
// image goes here
</div>
</div>
【问题讨论】: