上个项目是卖东西的,商品详情传的组图,排上去后发现每张图片下有大概10+rpx的下边距,显得很不好看。查了一下貌似是小程序的默认样式。没找到解决方案,看到有说用微信编辑器传图的,好像很麻烦就没去试,自己琢磨了两种方法。
原本不做处理的样子:
- .det-pics-w image {
- width: 100%;
- min-height: 630rpx;
- }
- .det-pics-w {
- position: relative;
- }
第一种解决方案:flex
- .det-pics-w image {
- width: 100%;
- min-height: 630rpx;
- }
- .det-pics-w {
- position: relative;
- display: flex;
- flex-direction: column;
- }
第二种解决方式:margin-top负值
- .det-pics-w image {
- width: 100%;
- min-height: 630rpx;
- margin-top: -12rpx;
- }
- .det-pics-w {
- position: relative;
- }
两种都可以去掉这个间隙。效果如下