CSS——css 左上三角包含文字或左上三角包含对勾样式

左上三角包含对勾效果:
外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

代码:

<template>
  <view class="list position-relative active">
    <view class="title"> 测试文本测试文本 </view>
  </view>
</template>

<style lang="scss" scoped>
.active {
  position: relative;
  border: 1rpx solid #1677ff;
  &:before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    border: 25rpx solid #1677ff;
    border-bottom-color: transparent;
    border-right-color: transparent;
    border-radius: 13rpx 0 0 0;
  }

  &:after {
    content: "";
    width: 4px;
    height: 10px;
    position: absolute;
    left: 5px;
    top: 2px;
    border: 1px solid #fff;
    border-bottom-color: transparent;
    border-right-color: transparent;
    transform: rotate(225deg);
  }
}

.list {
  border-radius: 13rpx;

  padding: 33rpx;
  margin-bottom: 25rpx;

  .title {
    font-size: 34rpx;
    color: rgba(0, 0, 0, 0.9);
    margin-bottom: 12rpx;
    font-weight: bold;
  }

  .content {
    font-size: 30rpx;
    color: rgba(0, 0, 0, 0.6);
  }
}
</style>

左上三角包含文字效果:
外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

代码:

<template>
  <div class="mark">
    <div class="text">标记</div>
  </div>
</template>

<style lang="scss" scoped>
.mark {
  width: 0px;
  height: 0px;
  border-top: 30px solid red;
  border-right: 30px solid transparent;
  position: relative;
}
.text {
  color: #fff;
  white-space: nowrap;
  transform: rotate(-45deg) scale(0.5);
  position: absolute;
  top: -29px;
  left: -8px;
}
</style>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值