0

How to add an arrow on the CSS vertical line by using just pure CSS?

My vertical line is just using the CSS border-right only, then I want to add a two-lines arrow on this line to make it like an arrow, like this:

enter image description here

<div  class="ve-line"></div>

.ve-line{
border-right: 1px solid rgb(232, 232, 232);
}
Andrew Morton
  • 24,203
  • 9
  • 60
  • 84
B.Cos
  • 418
  • 1
  • 13
  • 27

1 Answers1

2

You can create CSS triangle by using border than add another one larger triangle to create border like style and position it absolutly with right: -1px to place it on the line.

.ve-line{
  border-right: 1px solid rgb(232, 232, 232);
  height: 500px;
  position: relative;
}

.triangle {
  position: absolute;
  right: -1px;
  top: 100px;
}

.triangle:before,
.triangle:after {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
}

.triangle:before {
  border-top: 22px solid transparent;
  border-bottom: 22px solid transparent;
  border-right: 22px solid rgb(232, 232, 232);
}

.triangle:after {
  position: absolute;
  right: 0;
  top: 2px;
  border-top: 20px solid transparent;
  border-bottom: 20px solid transparent;
  border-right: 20px solid white;
}
<div  class="ve-line">
  <div class="triangle"></div>
</div>
Jax-p
  • 7,225
  • 4
  • 28
  • 58