【发布时间】:2021-03-17 23:31:10
【问题描述】:
我想将所有图像设置在中心,将五个图像设置在第一行,将其余图像设置在第二行的中心。我尝试了以下代码。
<section id="Section">
<h1 class="sectionTitle text-center">Images</h1>
<div class="row center" id="Logo">
<!-- All logo from firestore -->
</div>
</section>
我正在使用 firestore,这是我的 JavaScript 代码:
db.collection('images').orderBy('image').onSnapshot((snapshot) => {
//insertHtml("#main-content", response);
snapshot.docs.forEach(doc => {
var brand = '<div class="column">'
+ '<img src="images/'+ doc.data().image + '"></div>';
$("#Logo").append(brand);
});
});
这是我的css代码:
#Section .center {
display: block;
margin-left: auto;
margin-right: auto;
width: 80%;
}
#Section .row .column {
float: left;
width: 20%;
}
#Section .row .column img{
max-height: 115px;
max-width: 210px;
}
【问题讨论】:
-
您可以简单地使用来自:getbootstrap.com/docs/4.1/getting-started/introduction的引导模板
标签: html css bootstrap-4