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
|
想实现的效果:
我用你的代码可以啊,就这么显示的
.page{
display: flex;
height: 100vh;
flex-direction: column;
justify-content: center;
align-items: center
}
width height 得定义
审查元素,你会看到问题。比如说page的实际高度
.page{height:100vh;}
<view class="search" > <input placeholder="请输入要搜索的内容"></input> </view>
wxss
.search{ width: 80vw; height: 60rpx; display: flex; flex-direction: row; border: 1px solid slategray; border-radius: 40rpx; padding-left: 50rpx; align-items: center; align-self:center; }
为什么这个框无法居中啊