[微信小程序]swiper保持宽高比

用rpx做单位即可

swiper {
  height: 300rpx;
}

swiper-item image {
  width: 100%;
  height: 100%;
}

  • rpx(responsive pixel): 可以根据屏幕宽度进行自适应。规定屏幕宽为750rpx。如在 iPhone6 上,屏幕宽度为375px,共有750个物理像素,则750rpx = 375px = 750物理像素,1rpx = 0.5px = 1物理像素。
posted @   mycnblogs  阅读(3033)  评论(2编辑  收藏  举报
努力加载评论中...
AmazingCounters.com
广州php程序员
点击右上角即可分享
微信分享提示