CSS 实现右上角标签条

CSS   2024-07-20 11:23   63   0  
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>右上角标签条</title>
  <style>
    body {
      background: #f6f6f6;
    }
    .a{
      width:200px;
      height:200px;
      position:relative;
      background: #fff;
      overflow: hidden;
    }
    .b{
      width:100px;
      height:100px;
      position: absolute;
      /*background: green;*/
      top:-50px;
      right:-50px;
      transform: rotate(45deg);
    }
    .b span{
      position: absolute;
      bottom:0;
      display: block;
      font-size:16px;
      color:#fff;
      background: #36A8FF;
      width:100px;
      text-align: center;
    }
  </style>
</head>
<body>
  <div class="a">
    <div class="b">
      <div class="c"></div>
      <span>交易中</span>
    </div>
  </div>
</body>
</html>