我对所有这些网页内容都很陌生,所以请裸露在我身边。我正在尝试创建响应式网格布局。然而,我到目前为止已经到了一个4x2的网格,当我尝试添加更多的行时,它会一直出错。我已经设法让广场旋转,我有一个4x2的网格,我想做一个4x5的网格。不过,我似乎无法用div来实现它的布局。如何将行添加到响应式网格
有人可以告诉我如何解决这个问题,并让这个4x5网格,因为我很困惑。我的代码如下。请证明你的答案:)
CSS
.trigger{
width:64%;
height:64%;
background-color:white;
}
.hover-img, hover-img.hover_effect {
background-color:white;
position: relative;
width: 200px;
height: 200px;
-webkit-transition: all 1s ease-in-out;
-moz-transition: all 1s ease-in-out;
-ms-transition: all 1s ease-in-out;
-o-transition: all 1s ease-in-out;
transition: all 1s ease-in-out;
-webkit-transform: rotateY(180deg);
transform: rotateY(180deg);
-webkit-transform-style: preserve-3d;
text-align: center;
font-size: 0;
-webkit-user-select: none;
-webkit-touch-callout: none;
border-style: solid;
border-width: 1px;
border-color: #4595ff;
}
.trigger:hover > .hover-img {
-webkit-transform:rotateY(360deg);
-moz-transform:rotateY(360deg);
-ms-transform:rotateY(360deg);
-o-transform:rotateY(360deg);
transform:rotateY(360deg);
font-size:14px;
color:white;
}
.img1 {
background-size: 100% 100%;
background-repeat: no-repeat;
}
.img1:hover{
background-size: 100% 100%;
background-repeat: no-repeat;
}
.img2 {
background-size: 100% 100%;
background-repeat: no-repeat;
}
.img2:hover{
background-size: 100% 100%;
background-repeat: no-repeat;
}
.img3 {
background-size: 100% 100%;
background-repeat: no-repeat;
}
.img3:hover{
background-size: 100% 100%;
background-repeat: no-repeat;
}
.img4 {
background-size: 100% 100%;
background-repeat: no-repeat;
}
.img4:hover{
background-size: 100% 100%;
background-repeat: no-repeat;
}
.img5 {
background-size: 100% 100%;
background-repeat: no-repeat;
}
.img5:hover{
background-size: 100% 100%;
background-repeat: no-repeat;
}
.img6 {
background-size: 100% 100%;
background-repeat: no-repeat;
}
.img6:hover{
background-size: 100% 100%;
background-repeat: no-repeat;
}
#container{
width: 100%;
display:flex;
justify-content: space-around;
flex-wrap:nowrap;
}
.column{
float: left;
width: auto;
font-size: 12px;
}
HTML
<div id="container">
<div class="column">
<div class="trigger">
<div tabindex="0" class="maincontent hover-img img1">
</div>
</div>
<div class="trigger">
<div tabindex="0" class="maincontent hover-img img2">
</div>
</div>
</div>
<div class="column">
<div class="trigger">
<div tabindex="0" class="maincontent hover-img img3"></div>
</div>
<div class="trigger">
<div tabindex="0" class="maincontent hover-img img4">
</div>
</div>
</div>
<div class="column">
<div class="trigger">
<div tabindex="0" class="maincontent hover-img img5">
</div>
</div>
<div class="trigger">
<div tabindex="0" class="maincontent hover-img img6">
</div>
</div>
</div>
<div class="column">
<div class="trigger">
<div tabindex="0" class="maincontent hover-img img5">
</div>
</div>
<div class="trigger">
<div tabindex="0" class="maincontent hover-img img6">
</div>
</div>
</div>
</div>
相反,它可能更容易让行列。并且你在其中添加了整行元素。当你想要一个新的行时,你只需创建一个新行并填充它。 – Sevanteri 2015-02-10 08:48:24