Page Widget How to - Create triangular shape with transparent border color








Question

We would like to know how to create triangular shape with transparent border color.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
div#up {<!--from  www.j  a v  a2  s.c  om-->
  width: 0px;
  height: 0px;
  border-left: 50px solid transparent; /* left arrow slant */
  border-right: 50px solid transparent; /* right arrow slant */
  border-bottom: 50px solid #2f2f2f;
  /* bottom, add background color here */
}

.rot90 {
  -webkit-transform: rotate(45deg);
  -moz-transform: rotate(45deg);
  rotation: 45deg;
}
</style>
</head>
<body>
  <div id="position:relative;">
    <!-- UP -->
    <div id="up" class="rot90"></div>
  </div>
</body>
</html>

The code above is rendered as follows: