Page Widget How to - Create Horizontal border using image








Question

We would like to know how to create Horizontal border using image.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.box {<!--from   w ww . ja v  a 2s  .  c o m-->
  background: #16a085;
  width: 100px;
  color: white;
  padding: 100px;
  text-align: center;
  font-family: "monospace";
  font-weight: bold;
  font-size: 30px;
  margin: 5px;
  /* added position rule */
  position: relative;
}

.box:after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  right: 0;
  height: 3px;
  background: url('http://www.java2s.com/style/download.png') repeat;
}
</style>
</head>
<body>
  <div class="box">Hello World</div>
</body>
</html>

The code above is rendered as follows: