JSFiddle - React, Tailwind, and code Playground

by Collin Donahue-Oponski

HTML

<div>
    <span></span>
</div>

CSS

body {
    line-height: 25px;
    font-size: 20px;
}
div {
    line-height:120%;
}

JavaScript

var lineHeight = -1;
    var $span = $('span');
    var tree = $span.get().concat( $span.parents().get() );
    $(tree).each(function(index, element) {
        if (lineHeight < 0) {
            lineHeight = parseFloat($(element).css('line-height')) || -1;
        }
    });
    $(document.body).append('<br>line-height of span: '+lineHeight);