I donβt understand why the height of the span element is greater than its font size (margin and padding = 0): JSFiddle example
<head>
<style>
.analized-element {
font-size: 20px;
font-family: "Lucida Console", "Lucida Grande", monospace;
}
</style>
</head>
<body>
<span class="analized-element">Test message</span>
</body>
This problem exists only on Mac :
== analized-element =====
border-size: 0 0 0 0
padding: 0 0 0 0
font-size: 20px
offsetHeight: 23px
=========================
As we can see, there are 3 more pixels. The same example on Windows :
== analized-element =====
border-size: 0 0 0 0
padding: 0 0 0 0
font-size: 20px
offsetHeight: 20px
=========================
The height of the span is equal to its font size.
source
share