Page Widget How to - Set CSS border-left outside of an element box








Question

We would like to know how to set CSS border-left outside of an element box.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.element {<!-- ww w  .j ava2 s.  com-->
  display: block;
  width: 200px;
  height: 40px;
  border-top: 1px solid gray;
  border-bottom: 1px solid gray;
  border-left: 4px solid red;
  padding-left: 4px;
}
</style>
</head>
<body>
  <a class="element">Some Text</a>
</body>
</html>

The code above is rendered as follows: