为什么 line-height 设置为 px 受 parent 的 font-size 影响?

Why is line-height set in px affected by parent’s font-size?

我做了这个例子:http://codepen.io/tomsoderlund/pen/JYJpPR 来演示。

我正在 parent (.canvas) 上设置 font-size(=1 em 的大小)使用:

$('.canvas').css('font-size', emSize + 'px');

font-sizeline-height 都以 px 为单位设置。 font-size(正确地)不受 parent 的 em 大小的影响,但 line-height 是 - 为什么?

line-height 仅适用于块级元素。您必须将 display:block 添加到您的跨度中。

On block level elements, the line-height property specifies the minimum height of line boxes within the element.

On non-replaced inline elements, line-height specifies the height that is used to calculate line box height. On replaced inline elements such as buttons or other input elements, line-height has no effect.

MDN line-height