<view style="display: flex; align-items: center; flex-wrap: nowrap ;justify-content: space-between;"> <view class="f1 ml5" style="font-size:36rpx;font-weight:bold">我的会员信息:</view> <view style="width: 150rpx;background-color: #39b54a;border-radius: 20rpx;" > <view style="color: #ffffff;font-size: 28rpx;text-align: center;" >订单中心</view> </view> </view>怎么修改代码让这两个元素两端对齐?
时间: 2024-03-20 07:42:39 浏览: 232
IE6,IE7下实现white-space:pre-wrap
可以将父元素的`justify-content`属性设置为`space-between`,这样两个元素就会分别靠近父元素的两端对齐。修改后的代码如下:
```
<view style="display: flex; align-items: center; flex-wrap: nowrap; justify-content: space-between;">
<view class="f1 ml5" style="font-size: 36rpx; font-weight: bold;">我的会员信息:</view>
<view style="width: 150rpx; background-color: #39b54a; border-radius: 20rpx;">
<view style="color: #ffffff; font-size: 28rpx; text-align: center;">订单中心</view>
</view>
</view>
```
阅读全文