JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html><body>
<div id="wrap" style="">
<div id="test">TEST</div>
</div>
</body></html>
CSS
#wrap {
width: 400px; height: 400px; border: 1px solid black;
}
#test {
width: 25%; margin: 10%; background:gray;
}
#test.fail { background:red; }
#test.pass { background:green; }
JavaScript
(function($) {
var ow=$('#test').outerWidth(),
owm=$('#test').outerWidth(true),
expected={
ow : 100,
owm : 100 + (2*0.1*400)
};
if(expected.ow===ow && expected.owm===owm) {
$('#test').addClass('pass');
} else {
$('#test').addClass('fail');
}
$('#test').html(ow+"/"+owm);
})(jQuery);