scroll-view内部无法水平居中
发布于 4 年前 作者 ming71 6049 次浏览 来自 问答

在scroll-view里面,无法设置内部元素水平居中,只能在scroll-view内部在多嵌套一个view来进行内部元素水平居中,这是何解?代码如下:

<scroll-view scroll-y style=‘width: 100%; height: auto; display: flex; flex-direction: column; align-items: center;’>  

<view style='background-color: yellow; height: 200rpx; width: 200rpx;'></view>

</scroll-view>

无法把内部元素水平居中,包裹一个view才能

<scroll-view scroll-y style=‘width: 100%; height: auto;’>  

<view style='display: flex; flex-direction: column; align-items: center;'>

         <view style='background-color: yellow; height: 200rpx; width: 200rpx;'></view>

</view>

</scroll-view>

求大佬解惑

1 回复
回到顶部