Page Widget How to - Create CSS Arrow Left/Right








Question

We would like to know how to create CSS Arrow Left/Right.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.arrow-right {
  display: block;
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 30px solid green;
}<!--   w w  w  .  ja  v  a  2s.co m-->

.arrow-right i {
  display: block;
  position: relative;
  top: -10px;
  left: -30px;
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 3px solid white;
}

.arrow-left {
  display: block;
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-right: 30px solid green;
}

.arrow-left i {
  display: block;
  position: relative;
  top: -10px;
  left: 27px;
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-right: 3px solid white;
}
</style>
</head>
<body>
  <i class="arrow-right"><i></i></i>
  <i class="arrow-left"><i></i></i>
</body>
</html>

The code above is rendered as follows: