A problem of layout

problem description

span,div wrapped in div has no height set, but it is always much higher than span"s;

div sets nothing and has no parent influence

the environmental background of the problems and what methods you have tried

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?

Apr.08,2022

roughly tried, there are three ways to achieve this effect:
1.div and span apply different line-height . If the line-height of div is greater than that of span, and span sets vertical-align: top; , this effect can occur. line-height on div is not necessarily set on itself, but can inherit the parent.
2.div has padding-bottom set.
3.span sets display block level and margin-bottom .

you can see which attributes are applied by themselves in the properties, not necessarily declarative.

Menu