Page Widget How to - Simulate CSS ridge border with custom colors on each side








Question

We would like to know how to simulate CSS ridge border with custom colors on each side.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
#default {<!--   ww w .j  ava 2s.co m-->
  border: ridge 20px orange;
}

#customized {
  border: solid 10px;
  border-right-color: red;
  border-bottom-color: red;
  border-left-color: blue;
  border-top-color: blue;
  margin: 0;
}

div {
  border: solid 10px;
  border-right-color: blue;
  border-bottom-color: blue;
  border-left-color: red;
  border-top-color: red;
}
</style>
</head>
<body>
  <p id="default">This is a paragraph with default ridge</p>
  <div>
    <p id="customized">This is a paragraph with customized ridge</p>
  </div>
</body>
</html>

The code above is rendered as follows: