Page Widget How to - Set the css border to one-side only








Question

We would like to know how to set the css border to one-side only.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
div {<!--   www. j av  a2  s  .c  o  m-->
  border-left: solid red 3px;
  border-right: solid pink 4px;
  border-top: solid blue 4px;
  border-bottom: solid green 4px;
  background: grey;
  width: 100px;
  height: 50px
}
</style>
</head>
<body>
  <div>sd</div>
</body>
</html>

The code above is rendered as follows: