/* pages/add/index.wxss */ page{ background-color: white; } .card { margin: 16rpx; border-radius: 16rpx; } .bg { width: 100rpx; height: 100rpx; background-color:#A4B7FA ; border-radius: 100rpx; } .grid { width: 100vw; display: grid; grid-template-columns: 1fr 1fr; /* 两列等分 */ gap: 32rpx; /* 图片间隔 */ box-sizing: border-box; padding: 16rpx; } .item { position: relative; width: 100%; padding-top: 75%; /* 高宽比 = 4:3,可以改成 100% 就是正方形 */ overflow: hidden; } .pic { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; /* 小程序等效是 mode="aspectFill" */ border-top-left-radius: 16rpx; border-top-right-radius: 16rpx; } .pic1{ width: 100rpx; height: 100rpx; border-radius: 16rpx; }