CSS实现div实心和空心箭头

在这里插入图片描述

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta
      name="viewport"
      content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"
    />
    <title>timeline</title>
    <style>
      .main {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
      }
      .container {
        display: flex;
      }
      .mod {
        display: flex;
        margin: 10px;
        width: 120px;
        height: 120px;
        border: 2px dashed #000;
      }
      .center-h-v {
        margin: auto;
      }
      /*实心右箭头*/
      .to_solid_right {
        width: 0;
        height: 0;
        border-style: solid;
        border-width: 10px 0 10px 20px;
        border-color: transparent transparent transparent #000;
      }
      /*实心左箭头*/
      .to_solid_left {
        width: 0;
        height: 0;
        border-style: solid;
        border-width: 10px 20px 10px 0;
        border-color: transparent #000 transparent transparent;
      }
      /*实心上箭头*/
      .to_solid_top {
        width: 0;
        height: 0;
        border-style: solid;
        border-width: 0 10px 20px 10px;
        border-color: transparent transparent #000 transparent;
      }
      /*实心下箭头*/
      .to_solid_botton {
        width: 0;
        height: 0;
        border-style: solid;
        border-width: 20px 10px 0 10px;
        border-color: #000 transparent transparent transparent;
      }
      /*空心下箭头*/
      .to_botton {
        width: 10px;
        height: 10px;
        transform: rotate(45deg);
        border-bottom: 1px solid #000;
        border-right: 1px solid #000;
      }
      /*空心上箭头*/
      .to_top {
        width: 10px;
        height: 10px;
        transform: rotate(45deg);
        border-top: 1px solid #000;
        border-left: 1px solid #000;
      }
      /*空心右箭头*/
      .to_right {
        width: 10px;
        height: 10px;
        transform: rotate(45deg);
        border-right: 1px solid #000;
        border-top: 1px solid #000;
      }
      /*空心左箭头*/
      .to_left {
        width: 10px;
        height: 10px;
        transform: rotate(45deg);
        border-left: 1px solid #000;
        border-bottom: 1px solid #000;
      }
    </style>
  </head>

  <body>
    <div class="main">
      <div class="container">
        <div class="mod">
          <div class="to_top center-h-v"></div>
        </div>
        <div class="mod">
          <div class="to_botton center-h-v"></div>
        </div>
        <div class="mod">
          <div class="to_left center-h-v"></div>
        </div>
        <div class="mod">
          <div class="to_right center-h-v"></div>
        </div>
      </div>
      <div class="container">
        <div class="mod">
          <div class="to_solid_top center-h-v"></div>
        </div>
        <div class="mod">
          <div class="to_solid_botton center-h-v"></div>
        </div>
        <div class="mod">
          <div class="to_solid_left center-h-v"></div>
        </div>
        <div class="mod">
          <div class="to_solid_right center-h-v"></div>
        </div>
      </div>
    </div>
  </body>
</html>

  • 1
    点赞
  • 0
    评论
  • 0
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

©️2021 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值