请问使用flex布局无法让项目在主轴上居中对齐怎么解决?
发布于 7 年前 作者 mengjie 11444 次浏览 来自 问答

page.wxml代码如下:

<view class="page">
  <view >
    <icon type="info" size="60" color="tomato"></icon>
  </view>
 
  <view >
    <text>本页面仅针对开发者开放</text>
  </view>
</view>

page.wxss代码如下:

.page{
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center

}

想实现的效果:

4 回复

审查元素,你会看到问题。比如说page的实际高度

我用你的代码可以啊,就这么显示的

.page{height:100vh;}

width height  得定义

回到顶部