Page Widget How to - Use before class to change border rendering








Question

We would like to know how to use before class to change border rendering.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
div {<!--from   ww w  .  j  a  va  2  s  .c  o  m-->
  width: 200px;
  height: 200px;
  position: relative;
}

.border {
  border: 15px silver solid;
}

.red-mark:before {
  content: '';
  display: block;
  width: 15px;
  position: absolute;
  top: -15px;
  left: -15px;
  bottom: -15px;
  background: red;
}
</style>
</head>
<body>
  <div class="border red-mark"></div>
</body>
</html>

The code above is rendered as follows: