The code below puts extra space between some text and again some text.
Why is the
<br>
element betweensome text
andagain some text
not getting 0 height. I tried bothline-height: 0
andheight: 0
.The second
span
element's text in not taking 20px line-height, why?
Note: Please do not tell how to solve the problem. I only want to know why line-height
works on inline
elements like span
this way.
.container {
border: 1px solid black;
}
.one {
line-height: 12px;
font-size: 10px;
vertical-align: top;
}
.two {
line-height: 20px;
vertical-align: bottom;
font-size: 10px;
}
br {
line-height: 0;
height: 0;
display: block;
}
<div class="container">
<span class=one>
some text <br>
agian some text <br>
</span>
<span class="two">
hip hop
</span>
</div>