mcbeav mcbeav - 2 months ago 26
CSS Question

Any way to limit border length?

Is there any way to limit the length of a border. I have a

that has a bottom border, but I want to add a border on the left of the
that only stretches half of the way up.

Is there any way to do so without adding extra elements on the page?


Hope this helps:

#mainDiv {
  height: 100px;
  width: 80px;
  position: relative;
  border-bottom: 2px solid #f51c40;
  background: #3beadc;

#borderLeft {
  border-left: 2px solid #f51c40;
  position: absolute;
  top: 50%;
  bottom: 0;
<div id="mainDiv">
  <div id="borderLeft"></div>