JSFiddle - React, Tailwind, and code Playground

by pramendra

HTML

<html>
    <body>
        <table>
            <tr>
                <td>
                    <p>This should set cell width
                        <span>This longer line should wrap at the length of the above  &lt;p&gt; element width.</span>
                        
                    </p>
                </td>
            </tr>
        </table>
    </body>
</html>

CSS

p{
    background:#f00;
}
p span{
    background:#ff0;
}

JavaScript

$('td span').hide();
width = $('td').width();
$('td').css('width', width);
$('td span').show();