css 几行代码实现 <>箭头、三角形▲

箭头 < >

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title></title>
  <style type="text/css">
    .box{
      
      
      position: relative;
    }
    .box:before{
      
      
      content:  '';
      position: absolute;
      height: 20px;
      width: 20px;
      border-width: 0 2px 2px 0;
      border-style: solid;
      color: orange;
      /* 根据这个来控制箭头方向 */
      transform: rotate(-45deg);
    }
  </style>
</head>
<body>
  <div class="box"></div>
</body>
</html>

在这里插入图片描述

三角形

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title></title>
  <style type="text/css">
    .box{
      
      
      width: 0px;
      position: relative;
      border: 10px solid orange;
      /* 根据下面这个来调整三角形的方向,想展示哪边就把其它几个设置透明即可 */
      border-bottom-color: transparent;
      border-top-color: transparent;
      border-right: transparent;
    }
  </style>
</head>
<body>
  <div class="box"></div>
</body>
</html>

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/cookcyq__/article/details/121845495
今日推荐