0
我发现下面的图片网格(链接),我正在使用,但当前当网格调整大小的方块变小时,我喜欢它,因此方块落在彼此之下而不是调整大小。这怎么可能?我试着添加浮动和调整宽度,但我显然错过了一些愚蠢的东西?如何获得这个网格不能调整大小?
CSS
.container {
border: 1px solid #fff;
ul {
display: block;
float: left;
width: 100%;
}
li {
box-sizing: border-box;
display: block;
float: left;
overflow: hidden;
position: relative;
padding-bottom: 33.3%;
width: 33.3%;
background-color: #000;
border: 2px solid #fff;
&:hover {
h3 {
opacity: 1;
transition: all .3s ease-in-out .1s;
}
img {
opacity: 1;
transform: scale(1);
}
}
h3 {
position: absolute;
left: 0px;
min-height: 3em;
padding: 15px;
right: 0px;
top: 0px;
z-index: 10;
background: linear-gradient(180deg, rgba(0, 0, 0, .65), rgba(0, 0, 0, 0));
color: #fff;
font-size: 16px;
font-weight: bold;
line-height: 1.5em;
opacity: 0;
transition: all .3s ease-in-out;
}
img {
position: absolute;
bottom: 0;
left: 0;
max-height: 110%;
max-width: 110%;
opacity: .7;
right: 0;
top: 0;
transform: scale(1.1);
transition: all .3s ease-in-out;
z-index: 0;
}
}
}
@ Zi_31如果这个答案适合你,不要忘记标记为已接受。 –