头部固定,但是内容往上移并有遮盖的解决方案

<template>
  <div class="demo">
    <!-- <mt-header fixed title="long long long long title">
      <mt-button slot="left">back</mt-button>
      <mt-button icon="more" slot="right"></mt-button>
    </mt-header> -->
      <div class="flex">
      <p>左</p>
      <p>内容</p>
      <p>右</p>
    </div>
    <div class="flexd">
      <p>左</p>
      <p>内容</p>
      <p>右</p>
    </div>
    <div class="main">
      <img
        src="https://tpc.googlesyndication.com/simgad/585319185461864364?sqp=4sqPyQQ7QjkqNxABHQAAtEIgASgBMAk4A0DwkwlYAWBfcAKAAQGIAQGdAQAAgD-oAQGwAYCt4gS4AV_FAS2ynT4&rs=AOga4qn6awnIZTNsp9aZAsaggIvDtJdLDA"
        alt
      />
      <img
        src="https://tpc.googlesyndication.com/simgad/585319185461864364?sqp=4sqPyQQ7QjkqNxABHQAAtEIgASgBMAk4A0DwkwlYAWBfcAKAAQGIAQGdAQAAgD-oAQGwAYCt4gS4AV_FAS2ynT4&rs=AOga4qn6awnIZTNsp9aZAsaggIvDtJdLDA"
        alt
      />
      <img
        src="https://tpc.googlesyndication.com/simgad/585319185461864364?sqp=4sqPyQQ7QjkqNxABHQAAtEIgASgBMAk4A0DwkwlYAWBfcAKAAQGIAQGdAQAAgD-oAQGwAYCt4gS4AV_FAS2ynT4&rs=AOga4qn6awnIZTNsp9aZAsaggIvDtJdLDA"
        alt
      />
      <img
        src="https://tpc.googlesyndication.com/simgad/585319185461864364?sqp=4sqPyQQ7QjkqNxABHQAAtEIgASgBMAk4A0DwkwlYAWBfcAKAAQGIAQGdAQAAgD-oAQGwAYCt4gS4AV_FAS2ynT4&rs=AOga4qn6awnIZTNsp9aZAsaggIvDtJdLDA"
        alt
      />
    </div>
  </div>
</template>
<script>
export default {};
</script>
<style lang="scss" scoped>
.demo /deep/.mint-header.is-fixed {
    top: 0;
    right: 0;
    left: 0;
   position: sticky;
    z-index: 1;
}
.demo {
  width: 100vw;
  padding: 0;
  margin: 0;
  .flex{
        position: sticky;
    top: 0%;
    left: 0;
    width: 100vw;
    background: gray;
    padding: 0.1rem 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    p {
      font-size: 0.25rem;
      color: #ffffff;
    }

  }
  .flexd {
    position: sticky;
    top: 4%;
    left: 0;
    width: 100vw;
    background: gray;
    padding: 0.1rem 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    p {
      font-size: 0.25rem;
      color: #ffffff;
    }
  }
  .main {
    margin-top: 0.1rem;
    img {
      width: 100;
    }
  }
}
</style>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值