Page Widget How to - Create double border with 2 colors without using outline








Question

We would like to know how to create double border with 2 colors without using outline.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
#borders {<!--from   w ww . j ava 2 s . com-->
  position: relative;
  z-index: 10;
  padding: 30px;
  background: #fff;
  border: 2px solid #390;
}

#borders:before {
  content: "";
  display: block;
  position: absolute;
  z-index: -1;
  top: 2px;
  left: 2px;
  right: 2px;
  bottom: 2px;
  border: 2px solid #36F
}
</style>
</head>
<body>
  <div id="borders"></div>
</body>
</html>

The code above is rendered as follows: