时间:2021-07-01 10:21:17 帮助过:41人阅读
大致效果如下图,只考虑垂直方向。长图可以通过滚动条看,短图居中效果,布局合理

html代码(vue作用域内):
<p class="box" v-for="item in previewImg"> <img :src="item" alt="" @load="checkHeight($event)"> </p>
css代码:
.box{
height: 100%;//如高度等于网页高度
overflow: auto;
display: flex;
flex-direction: column;
justify-content: space-around;
}
.swiper-slide.long{
justify-content: flex-start;
}js代码(vue作用域内,使用jquery):
相关推荐:
在css里div怎么垂直居中
css实现元素水平、垂直居中
设置元素水平、垂直居中有哪两种方式
以上就是vue实现长图垂直居上短图垂直居中的方法实例的详细内容,更多请关注Gxl网其它相关文章!