<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; } [图片] 为什么这个框无法居中啊
请问使用flex布局无法让项目在主轴上居中对齐怎么解决?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[代码][代码]}[代码] 想实现的效果: [图片]
2020-05-06