【发布时间】:2021-10-27 12:59:04
【问题描述】:
我正在尝试使用 Bootstrap、CSS 和 NuxtJS 构建图像马赛克。我有五张图片,第一张必须在中间。相对于第一个图像,左侧有两个图像,右侧有两个图像(所有图像都是正方形)。这是我的代码,但我在移动和桌面设计(必须是响应式设计)方面存在一些问题,并且不知道如何将第一张图片居中。有人帮我吗?提前致谢。
<div class="container d-flex flex-md-column flex-lg-row">
<div class="small-tiles flex-md-row flex-lg-column">
<img
src="../../assets/images/image2.png"
alt="The second image"
/>
<img
src="../../assets/images/image3.png"
alt="The third image"
/>
</div>
<div class="center-tile d-flex flex-column">
<img
src="../../assets/images/image1.png"
alt="The first image"
/>
</div>
<div class="small-tiles flex-md-row flex-lg-column">
<img
src="../../assets/images/image4.png"
alt="The fourth image"
/>
<img
src="../../assets/images/image5.png"
alt="The fiveth image"
/>
</div>
</div>
</template>
<script>
export default {
}
</script>
<style lang="scss" scoped>
.container {
width: 100%;
}
.small-tiles {
@media only screen and (max-width: 576) {
width: 100%;
height: 25%;
}
@media only screen and (min-width: 576px) {
width: 25%;
height: 100%;
}
}
.center-tile {
@media only screen and (max-width: 576) {
width: 100%;
height: 50%;
}
@media only screen and (min-width: 576px) {
width: 50%;
height: 100%;
}
}
</style>
【问题讨论】:
-
你想让所有的图片都一样大吗?
-
是的,我愿意。所有图片的大小必须相同
标签: css twitter-bootstrap bootstrap-4 sass nuxt.js