in the process of writing HTML and CSS, I found that I didn"t understand line-height.
HTML Code:
<div class="p">
<span class="c">Color</span>
</div>
CSS Code:
*{
margin:0;
padding:0
}
.c{
color:white;
font-size:20px;
line-height:40px;
background:orange;
display:block
}
effect:
The code is very simple, the height of the span tag is 40px, but what I want to ask is, if you comment out the line display:block above, the height of the span tag is 22px, while the height of the div becomes 40px, and the range of background colors only includes the span tag
question:
if there is no display:block, line-height alone for 40px does not support the height of the span tag? But propped up the height of div to 40px?
Link: Link