微信小程序自制底部菜单栏

子容器横向布局,在父容器添加最后两行

.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真机测试没问题

 

 

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值