Page Widget How to - Stack border with after element selector








Question

We would like to know how to stack border with after element selector.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.test {<!--from  www .  j a v a 2s  . co m-->
  position: relative;
  height: 100px;
  width: 152px;
  overflow: hidden;
  border-left: 26px double red;
  border-right: 26px double red;
}

.test:after {
  width: 100px;
  height: 102px;
  content: "";
  position: absolute;
  background-color: #06F;
  border-left: 26px double #000;
  border-right: 26px double #000;
}
</style>
</head>
<body>
  <div class="test"></div>
</body>
</html>

The code above is rendered as follows: