JSFiddle - React, Tailwind, and code Playground

by Terry Mun

HTML

<div id='parent'>
   <div id='child'>
       
   </div>
</div>

CSS

#parent {
     background-color: #ccc;
     width:1000px;
     height:1000px
 }
 #child {
    background-color: #333;
    color: #eee;
    width:20%;
    height:40%;
    margin-top:10%;
 }

JavaScript

$(document).ready(function() {
    var $c = $('#child'),
        log = 'Child width: ' + $c.height() + '<br />';
    log += 'Child height: ' + $c.width() + '<br />';
    log += 'Child margin-top: ' + parseInt($c.css('margin-top')) + '<br />';
    $c.append(log); 
});