css实现三角箭头

在这里插入图片描述

HTML代码

<div class="arrow1">上箭头</div>
<div class="arrow2">下箭头</div>
<div class="triangle1">左实心三角</div>
<div class="triangle2">右实心三角</div>

CSS代码

/*各个部分样式*/

@charset "utf-8";
.wrapper {
  width: 100%;
  height: 100%;
  padding: 50px;
}

div {
  width: 108px;
  margin: 30px auto;
  position: relative;
  font-size: 16px;
}
/*----上箭头----*/
.arrow1:before {
  position: absolute;
  right: 20px;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -2px;
  border-right: 1px solid #000;
  border-bottom: 1px solid #000;
  -webkit-transform: rotate(225deg);
  content: '';
}
/*----下箭头----*/
.arrow2:before {
  position: absolute;
  right: 20px;
  top: 5px;
  width: 12px;
  height: 12px;
  border-right: 1px solid #000;
  border-bottom: 1px solid #000;
  transform: rotate(45deg);
  -webkit-transform: rotate(45deg);
  content: '';
}
/*----左实心三角----*/
.triangle1 {
  display:block;
  width: 0;
  height: 0;
  overflow: hidden;
  margin: 20px auto;
  line-height: 0;
  font-size: 0;
  vertical-align: middle;
  border-right: 10px solid red;
  border-left: 0 none;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  _color: #FF3FFF;
  _filter: chroma(color=#FF3FFF);
}
/*----右实心三角----*/
.triangle2 {
  display: block;
  margin: 20px auto;
  width: 0;
  height: 0;
  overflow: hidden;
  line-height: 0;
  font-size: 0;
  vertical-align: middle;
  border-left: 10px solid red;
    border-right: 0 none;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  _color: #FF3FFF;
  _filter: chroma(color=#FF3FFF);
}
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值