Page Widget How to - Create rounded diagonal line with border








Question

We would like to know how to create rounded diagonal line with border.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
body {<!--from   w w w.j a  v a  2s.  co m-->
  -webkit-perspective: 15em;
  perspective: 15em;
}

.block {
  margin: 50px auto;
  width: 300px;
  height: 10px;
  background: black;
  -webkit-border-radius: 5px;
  -moz-border-radius: 5px;
  border-radius: 5px;
  -webkit-transform: rotateX(-5deg) rotateY(10deg);
  transform: rotateX(-5deg) rotateY(10deg);
}
</style>
</head>
<body>
  <div class="block"></div>
</body>
</html>

The code above is rendered as follows: