定位居中,小程序图片宽高自适应

position为relative的时候实现上下左右居中

  width: 200rpx;
  height: auto;
  border-radius: 50%;
  position: relative;
  top: 50%;
  left: 50%;
  transform: translate(-50%, calc(-50% - 20rpx));

微信小程序的图片高度如何根据宽度自适应

  <image src="/images/。。。" mode="widthFix" class="logo" />

mode为widthFix则是设置宽度高度自适应

heightFix为设置高度宽度自适应

猜你喜欢

转载自blog.csdn.net/aleluye/article/details/130139174
今日推荐