线CSS实现对比效果

简介: 线CSS实现对比效果

线CSS实现对比效果,CSS对比效果,传统大家都是用图片来实现对比效果,其实这个对比效果用的理上下两个三角形来做出一个斜体对比效果。

实现的效果是兼容uniapp微信小程序等不同端的代码

<template>
  <view class="container container23285">
    <view class="flex diygw-col-24 items-stretch flex-nowrap flex48-clz">
      <view class="diygw-col-12 text42-clz"> 看涨 </view>
      <view class="flex diygw-col-0 items-stretch flex-wrap flex57-clz">
        <view class="diygw-col-0 text53-clz"> </view>
        <view class="diygw-col-0 text54-clz"> </view>
      </view>
      <view class="diygw-col-12 text43-clz"> 看跌 </view>
    </view>
    <view class="flex flex-wrap diygw-col-24 flex-direction-column flex41-clz">
      <view class="flex flex-wrap diygw-col-24 justify-between flex42-clz">
        <view class="diygw-col-0 text36-clz"> 60% </view>
        <view class="diygw-col-0 text37-clz"> 40% </view>
      </view>
      <view class="flex diygw-col-24 items-stretch flex-nowrap flex43-clz">
        <view class="diygw-col-14 text38-clz"> </view>
        <view class="flex diygw-col-0 items-stretch flex-wrap flex44-clz">
          <view class="diygw-col-0 text39-clz"> </view>
          <view class="diygw-col-0 text40-clz"> </view>
        </view>
        <view class="diygw-col-12 text41-clz"> </view>
      </view>
      <view class="flex flex-wrap diygw-col-24 justify-between flex45-clz">
        <view class="flex flex-wrap diygw-col-0 items-center flex46-clz">
          <text class="flex icon2 diygw-col-0 icon2-clz diy-icon-appreciate"></text>
          <view class="diygw-col-0 text44-clz"> 看涨 </view>
        </view>
        <view class="flex flex-wrap diygw-col-0 items-center flex47-clz">
          <text class="flex icon3 diygw-col-0 icon3-clz diy-icon-appreciate"></text>
          <view class="diygw-col-0 text45-clz"> 看跌 </view>
        </view>
      </view>
    </view>
    <view class="clearfix"></view>
  </view>
</template>
 
<script>
  export default {
    data() {
      return {
        //用户全局信息
        userInfo: {},
        //页面传参
        globalOption: {},
        //自定义全局变量
        globalData: {}
      };
    },
    onShow() {
      this.setCurrentPage(this);
    },
    onLoad(option) {
      this.setCurrentPage(this);
      if (option) {
        this.setData({
          globalOption: this.getOption(option)
        });
      }
 
      this.init();
    },
    methods: {
      async init() {}
    }
  };
</script>
 
<style lang="scss" scoped>
  .flex48-clz {
    margin-left: 20rpx;
    border-bottom-left-radius: 12rpx;
    overflow: hidden;
    width: calc(100% - 20rpx - 20rpx) !important;
    border-top-left-radius: 12rpx;
    margin-top: 20rpx;
    border-top-right-radius: 12rpx;
    border-bottom-right-radius: 12rpx;
    margin-bottom: 20rpx;
    margin-right: 20rpx;
  }
  .text42-clz {
    background-color: #ff2600;
    padding-top: 10rpx;
    color: #ffffff;
    padding-left: 10rpx;
    font-size: 28rpx !important;
    padding-bottom: 10rpx;
    text-align: center;
    padding-right: 10rpx;
  }
  .flex57-clz {
    flex-shrink: 0;
    width: 100rpx !important;
  }
  .text53-clz {
    flex-shrink: 0;
    color: #ffffff;
    top: 0rpx;
    left: 0rpx;
    flex: 1;
    border-left: 80rpx solid #ff2600;
    width: 0rpx !important;
    font-size: 28rpx !important;
    position: absolute;
    border-bottom: 60rpx solid rgba(255, 255, 255, 0);
    height: 0rpx !important;
    text-align: center;
  }
  .text54-clz {
    border-top: 60rpx solid rgba(255, 255, 255, 0);
    flex-shrink: 0;
    border-right: 80rpx solid #07c160;
    color: #ffffff;
    flex: 1;
    bottom: 0rpx;
    width: 0rpx !important;
    font-size: 28rpx !important;
    position: absolute;
    right: 0rpx;
    height: 0rpx !important;
    text-align: center;
  }
  .text43-clz {
    background-color: #07c160;
    padding-top: 10rpx;
    color: #ffffff;
    padding-left: 10rpx;
    font-size: 28rpx !important;
    padding-bottom: 10rpx;
    text-align: center;
    padding-right: 10rpx;
  }
  .flex41-clz {
    padding-top: 10rpx;
    border-bottom-left-radius: 12rpx;
    padding-left: 10rpx;
    padding-bottom: 10rpx;
    border-top-right-radius: 12rpx;
    margin-right: 20rpx;
    margin-left: 20rpx;
    box-shadow: 0rpx 2rpx 14rpx rgba(31, 31, 31, 0.09);
    overflow: hidden;
    width: calc(100% - 20rpx - 20rpx) !important;
    border-top-left-radius: 12rpx;
    margin-top: 20rpx;
    border-bottom-right-radius: 12rpx;
    background-image: linear-gradient(180deg, rgba(255, 228, 228, 1) 0%, rgba(255, 255, 255, 0) 39%);
    margin-bottom: 20rpx;
    padding-right: 10rpx;
  }
  .flex42-clz {
    margin-left: 10rpx;
    width: calc(100% - 10rpx - 10rpx) !important;
    font-size: 28rpx !important;
    margin-top: 10rpx;
    margin-bottom: 10rpx;
    margin-right: 10rpx;
  }
  .text36-clz {
    color: #ff2600;
  }
  .text37-clz {
    color: #07c160;
  }
  .flex43-clz {
    margin-left: 10rpx;
    border-bottom-left-radius: 12rpx;
    overflow: hidden;
    width: calc(100% - 10rpx - 10rpx) !important;
    border-top-left-radius: 12rpx;
    margin-top: 10rpx;
    border-top-right-radius: 12rpx;
    border-bottom-right-radius: 12rpx;
    margin-bottom: 10rpx;
    margin-right: 10rpx;
  }
  .text38-clz {
    background-color: #ff2600;
    padding-top: 10rpx;
    color: #ffffff;
    padding-left: 10rpx;
    font-size: 28rpx !important;
    padding-bottom: 10rpx;
    text-align: center;
    padding-right: 10rpx;
  }
  .flex44-clz {
    flex-shrink: 0;
    width: 44rpx !important;
    height: 20rpx !important;
  }
  .text39-clz {
    flex-shrink: 0;
    color: #ffffff;
    top: 0rpx;
    left: 0rpx;
    flex: 1;
    border-left: 30rpx solid #ff2600;
    width: 0rpx !important;
    font-size: 28rpx !important;
    position: absolute;
    border-bottom: 20rpx solid rgba(255, 255, 255, 0);
    height: 0rpx !important;
    text-align: center;
  }
  .text40-clz {
    border-top: 20rpx solid rgba(255, 255, 255, 0);
    flex-shrink: 0;
    border-right: 30rpx solid #07c160;
    color: #ffffff;
    flex: 1;
    bottom: 0rpx;
    width: 0rpx !important;
    font-size: 28rpx !important;
    position: absolute;
    right: 0rpx;
    height: 0rpx !important;
    text-align: center;
  }
  .text41-clz {
    background-color: #07c160;
    padding-top: 10rpx;
    color: #ffffff;
    padding-left: 10rpx;
    font-size: 28rpx !important;
    padding-bottom: 10rpx;
    text-align: center;
    padding-right: 10rpx;
  }
  .flex45-clz {
    margin-left: 10rpx;
    width: calc(100% - 10rpx - 10rpx) !important;
    font-size: 28rpx !important;
    margin-top: 10rpx;
    margin-bottom: 10rpx;
    margin-right: 10rpx;
  }
  .flex46-clz {
    background-color: #ffe4e4;
    padding-top: 6rpx;
    border-bottom-left-radius: 120rpx;
    overflow: hidden;
    color: #ff2600;
    padding-left: 30rpx;
    padding-bottom: 6rpx;
    border-top-left-radius: 120rpx;
    border-top-right-radius: 120rpx;
    border-bottom-right-radius: 120rpx;
    padding-right: 30rpx;
  }
  .icon2 {
    font-size: 36rpx;
  }
  .text44-clz {
    font-weight: bold;
    font-size: 28rpx !important;
  }
  .flex47-clz {
    background-color: #e1fff4;
    padding-top: 6rpx;
    border-bottom-left-radius: 120rpx;
    overflow: hidden;
    color: #07c160;
    padding-left: 30rpx;
    padding-bottom: 6rpx;
    border-top-left-radius: 120rpx;
    border-top-right-radius: 120rpx;
    border-bottom-right-radius: 120rpx;
    padding-right: 30rpx;
  }
  .icon3-clz {
    transform: translate(0rpx, 0rpx) rotate(180deg);
  }
  .icon3 {
    font-size: 36rpx;
  }
  .text45-clz {
    font-weight: bold;
    font-size: 28rpx !important;
  }
  .container23285 {
    padding-left: 0px;
    padding-right: 0px;
  }
  .container23285 {
  }
</style>
目录
相关文章
|
7月前
|
前端开发
css特效实例——纯css实现带边角卷边阴影的纸
css特效实例——纯css实现带边角卷边阴影的纸
63 1
|
9月前
|
前端开发
css实现风车样式
css实现风车样式
51 0
|
9月前
|
前端开发
css流光效果简单版
css流光效果简单版
116 0
|
前端开发
CSS实现中间粗两头细的线条
CSS实现中间粗两头细的线条
117 1
|
前端开发
css时间轴
css时间轴
55 0
|
前端开发
CSS阴影
CSS阴影
112 0
CSS阴影
CSS3阴影
CSS3阴影
104 0
|
前端开发 JavaScript 容器
|
前端开发 定位技术 索引
【前端第四课】CSS值和单位;CSS文字排版;CSS变换,过渡,动画;CSS定位
【前端第四课】CSS值和单位;CSS文字排版;CSS变换,过渡,动画;CSS定位
【前端第四课】CSS值和单位;CSS文字排版;CSS变换,过渡,动画;CSS定位

热门文章

最新文章