JSFiddle - React, Tailwind, and code Playground

HTML

<div class="box">20%</div>

CSS

.box {
    height: 100px;
    margin: 0 auto;
    width: 20%;
    background: #ddd;
}

JavaScript

var width = $('.box').clone().appendTo('body').wrap('<div style="display: none"></div>').css('width');
alert(width);