Page Widget How to - Add border to arrow








Question

We would like to know how to add border to arrow.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.arrowCollapse {<!--from  w  w  w  .  j  a v  a  2 s .  c  o  m-->
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(1, 1, 255, 0.3);
  border-radius: 2px;
  -webkit-transition: all 0.3s linear;
  -moz-transition: all 0.3s linear;
  -ms-transition: all 0.3s linear;
  -o-transition: all 0.3s linear;
  transition: all 0.3s linear;
}

.arrowCollapse:after {
  display: block;
  content: '';
  margin: 6px auto;
  width: 0;
  height: 0;
  border-top: 8px solid rgba(255, 1, 5, 0.7);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
}

.arrowCollapse:hover {
  border-color: rgba(255, 1, 5, 1);
  background: rgba(255, 1, 5, 0.2);
}

.arrowCollapse:hover:after {
  border-top-color: rgba(255, 1, 5, 1);
}

.arrowCollapse.active:after {
  margin-left: 1px;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-right: 8px solid rgba(255, 1, 5, 0.7);
}
</style>
</head>
<body>
  <div class="arrowCollapse"></div>
  <br>
  <div class="arrowCollapse active"></div>
</body>
</html>

The code above is rendered as follows: