Martin AJ Martin AJ - 3 months ago 7
CSS Question

How can I reduce the length of the element's border?

My question is really short and clear .. I want a shorter separator than this:



.myclass{
border-left: 1px solid;
margin-left: 4px;
padding-left: 4px;
height: 3px;
}

<span>Age</span><span class="myclass">21</span>





This is expected output:

enter image description here

As you see, I've set
height: 3px
but still the height of that
span
is bigger than
3px
. How can I make that border shorter?

Pat Pat
Answer

Setting the height of an inline element will have no effect. Add display: inline-block; for it to respect height: 3px;

Comments