小程序tab选项卡样式

12 篇文章 0 订阅
<view class='container'>

<!-- tab选项卡固定在头部 -->
  <view class='tabsHeader'>
      <image class="coursePic" 
      src="/images/banner1.jpg"></image>

      <view class='tabs'>
      <view class='tab1 tab_item'>
        <view>详细内容</view>
        <hr/>
      </view>
        <view class='tab2 tab_item'>
        <view>评论</view>
        <hr/>
      </view>
      <view class='tab3 tab_item'>
        <view>课程目录</view>
        <hr/>
      </view>
      </view>
  </view>

  <!-- tab对应内容超过滚动 -->
  <view class='contentWrap'>
    <view class='content'>1111</view>
    <view class='content'>1111</view>
    <view class='content'>1111</view>
    <view class='content'>1111</view>
    <view class='content'>1111</view>
    <view class='content'>1111</view>
  </view>

</view>

css:

container样式使用高度为100vh 设置高度为屏幕高度

tab头部和body 用弹性盒子模型来编写,body占据除tab head 部分之外所有的高度

tab对应的内容部分超出显示滚动条滚动

.container{
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
}

/* 头部 */
.coursePic{
  height: 300rpx;
}

.tabs{
  display: flex;
  flex-direction: row;
  padding: 20rpx 0;
  box-shadow: 0 4rpx 2rpx #ccc;
}

.tab_item{
  flex: 1;
  text-align: center;
}



/* tab对应的内容部分 */
.contentWrap{
  flex: 1;
  width: 100%;
  overflow: scroll;
}
.content{
  height: 400rpx;
}

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值