I can’t understand why, but two extra pixels are added to the height of the span element. Here is an example:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<span style="font-size:20px;line-height: 20px">
test
</span>
</body>
</html>
In debugger chrome tools, the range is 22 pixels long. If I change the test item to div, the extra pixels go away.
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div style="font-size:20px;line-height: 20px">
test
</div>
</body>
</html>
here is a violin with a span and div elements
source
share