微信小程序自制底部菜单栏
作者:互联网
子容器横向布局,在父容器添加最后两行
.bar{
width: 100%;
height: 10%;
border: lightgray 1px solid;
position: absolute;
bottom: 0px;
display: flex;
flex-direction: row;
}
自适应容器设置不了文字居中
.jia{
width: 40%;
height: 60%;
border: 1px solid black;
border-radius: 25px;
margin-left: 5%;
text-align: center;
line-height: 100%;
}
找教程搬代码
.jia{
width: 40%;
height: 60%;
border: 1px solid black;
border-radius: 25px;
margin-top: 10px;
margin-left: 5%;
display: flex;
align-items: center; /*实现上下居中*/
justify-content: center; /*实现水平居中*/
}
背景颜色渐变
background: linear-gradient(to right, #2c9dff, #39dfe7);
//自己做了尝试做了下自适应屏幕的底部栏效果还不错
总结一下
<view class="bar">
<view class="jia">加入书架</view>
<view class="yue">开始阅读</view>
</view>
.bar{
width: 100%;
height: 10%;
border: lightgray 1px solid;
position: absolute;
bottom: 0px;
display: flex;
flex-direction: row;
}
.jia{
width: 40%;
height: 60%;
border-radius: 25px;
margin-top: 10px;
margin-left: 5%;
display: flex;
align-items: center; /*实现上下居中*/
justify-content: center; /*实现水平居中*/
background-color: #f3f3f3;
}
.yue{
width: 40%;
height: 60%;
border-radius: 25px;
margin-left: 9%;
margin-top: 10px;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(to right, #2c9dff, #39dfe7);
}
模拟机型没问题
12mini真机测试没问题
标签:flex,center,微信,自制,height,width,margin,菜单栏,border 来源: https://blog.csdn.net/weixin_44788552/article/details/122038496