Page Widget How to - Create Double Border with right and left colors








Question

We would like to know how to create Double Border with right and left colors.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.foo {<!--from w ww .ja v a 2 s .  c o m-->
  width: 100px;
  height: 100px;
  border-style: solid;
  border-width: 0px 5px 0px 5px;
  border-right-color: orange;
  border-left-color: red;
  position: relative
}

.foo:before {
  content: "";
  border-style: solid;
  border-width: 0px 5px 0px 5px;
  border-right-color: green;
  border-left-color: blue;
  position: absolute;
  width: 100%;
  height: 100%;
}
</style>
</head>
<body>
  <div class="foo"></div>
</body>
</html>

The code above is rendered as follows: