项目中banner是一屏显示(不管多大的屏幕就是一整屏显示),本来通过background-img写,然后background-position:center center.就好了,但是要求必须把banner图放到img容器中,怎样设置这个img在swiper中上下左右居中(一屏情况下)。
1 回答

一只名叫tom的猫
TA贡献1906条经验 获得超3个赞
方法一:
html,body, .swiper-container{height:100%;}
方法二:
html,body .swiper-container{
display:flex;
flex-direction: column;
justify-content: space-between;
flex:1;
}
添加回答
举报
0/150
提交
取消