当前位置:主页 > 查看内容

CSS常用样式之绘制双箭头的示例代码

发布时间:2021-04-27 00:00| 位朋友查看

简介:一、多次调用单箭头 实现了单箭头就很容易实现双箭头了,上文已经介绍2种实现单箭头的原理: 边框旋转方式、双三角覆盖方式。这次以边框旋转为例多次调用实现双箭头。 1、边框旋转单箭头实现 .arrow-right{ height: 120px; width: 30px; display :inline-blo……

一、多次调用单箭头

实现了单箭头–就很容易实现双箭头了,上文已经介绍2种实现单箭头的原理: 边框旋转方式、双三角覆盖方式。这次以边框旋转为例多次调用实现双箭头。
1、边框旋转单箭头实现

.arrow-right{
  height: 120px;
  width: 30px;
  display :inline-block;
  position: relative;
}
.arrow-right::after {
  content: "";
  height: 60px;
  width: 60px;
  top: 12px;
  border-width: 8px 8px 0 0;
  border-color: blue;
  border-style: solid;
  transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
  position: absolute;
}

效果图如下:

在这里插入图片描述

2、多次调用单箭头

<div>
	<span class="arrow-right"/>
    <span class="arrow-right"/>
</div>

效果图如下:

在这里插入图片描述

二、旋转边框直接绘制双箭头

之前通过::after伪元素绘制单箭头,现在再加上::before伪元素再绘制一个单箭头就实现纯CSS绘制双箭头了。

.arrow-right{
  height: 120px;
  width: 30px;
  display :inline-block;
  position: relative;
}
.arrow-right::before {
  content: "";
  height: 60px;
  width: 60px;
  top: 12px;
  left: 30px;
  border-width: 8px 8px 0 0;
  border-color: blue;
  border-style: solid;
  transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
  position: absolute;
}
.arrow-right::after {
  content: "";
  height: 60px;
  width: 60px;
  top: 12px;
  border-width: 8px 8px 0 0;
  border-color: blue;
  border-style: solid;
  transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
  position: absolute;
}

效果图如下:

在这里插入图片描述

双三角覆盖这种方式也能直接绘制双箭头,但是实现比较麻烦,不如边框旋转方式好实现就不讲了

总结

到此这篇关于CSS常用样式之绘制双箭头的示例代码的文章就介绍到这了,更多相关css绘制双箭头内容请搜索脚本之家以前的文章或继续浏览下面的相关文章,希望大家以后多多支持脚本之家!


原文链接:https://m.jb51.net/css/743039.html
本站部分内容转载于网络,版权归原作者所有,转载之目的在于传播更多优秀技术内容,如有侵权请联系QQ/微信:153890879删除,谢谢!
上一篇:CSS中flex和inline-flex的区别详解 下一篇:没有了

推荐图文

  • 周排行
  • 月排行
  • 总排行

随机推荐