Page Widget How to - Zigzag border








Question

We would like to know how to zigzag border.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
div {<!--   ww  w .ja  v  a 2s.  co m-->
  background-color: gray;
  width: 200px;
  height: 200px;
}

.border {
  background-image: -webkit-linear-gradient(45deg, white 25%, transparent 25%, transparent 75%, white 75%, white),
    -webkit-linear-gradient(-45deg, white 25%, transparent 25%, transparent 75%, white 75%, white);
  background-size: 10px 10px;
  padding: 5px;
}
</style>
</head>
<body>
  <div class="border">
    <div class="content"></div>
  </div>
</body>
</html>

The code above is rendered as follows: