Css transform 覆盖上层元素?
发布于 4 年前 作者 zhangqiang 9462 次浏览 来自 问答

<view class="flex-center tab_bar" catchtap="toClassify">
  <view class="flex-center to_class">
    <text>{{ranking.classify}}</text>
    <text class="iconfont iconfont-right"></text>
  </view>
</view>


.tab_bar {
  width: 460rpx;
  height: 140rpx;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  z-index: 1;
}

.tab_bar::after {
  content: '';
  width: 460rpx;
  height: 140rpx;
  background: #FFFFFF;
  border-radius: 40rpx 40rpx 0 0;
  transform: perspective(40px) scale(0.9) rotateX(20deg);
  filter: drop-shadow(0px -10px 29px rgba(0, 0, 0, 0.07));
  box-sizing: border-box;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  z-index: 0;
}

.to_class {
  justify-content: center;
  font-size: 34rpx;
  font-weight: bold;
  color: #FA5136;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 40rpx;
  margin: 0 auto;
  z-index: 9;
  transform: translateZ(1);
}
回到顶部