JSFiddle - React, Tailwind, and code Playground

HTML

<div class="parent">
    <div class="child">20%</div>
</div>

CSS

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

JavaScript

$( function() {
    $('.parent').hide();
    var widthInteger = $('.child').width();
    var widthPercentage = $('.child').css('width');
    $('.parent').show();
    alert('Integer: ' + widthInteger + '. Percentage: ' + widthPercentage);
});