Page Widget How to - Create non rectangle border by combine shapes








Question

We would like to know how to create non rectangle border by combine shapes.

Answer


<!--from w ww  .j a  v a2s .c  o  m-->
<!DOCTYPE HTML>
<html>
<head>
<style>
div {
  width: 150px;
  border: 1px solid red;
  background: #fff;
  position: relative;
  margin-bottom: 5px;
  float: left;
}

.container {
  width: 309px;
  border: none;
}

.tallTop,.tallBottom {
  height: 400px;
}

.tallTop {
  float: right;
}

.shortTop,.shortBottom {
  height: 200px;
  z-index: 2;
  width: 157px;
}

.shortTop {
  margin-right: -1px;
  border-right: none;
}

.shortBottom {
  margin-left: -1px;
  border-left: none;
  float: right;
}
</style>
</head>
<body>
  <div class="container">
    <div class="shortTop"></div>
    <div class="tallTop"></div>
    test
    <div class="tallBottom"></div>
    <div class="shortBottom"></div>
  </div>
</body>
</html>

The code above is rendered as follows: