JSFiddle - React, Tailwind, and code Playground
HTML
<div id="container">
<div class="my-div">My Div</div>
</div>
<br />
<div id="output">
</div>
CSS
#container {
display: none;
}
.my-div {
display: block;
width: 100px;
margin-left: 10px;
}
JavaScript
// Output : 100
$('<p>').html('Width without margins = ' + $('.my-div').outerWidth()).appendTo('#output');
// Output : 10, should be 110 ?
$('<p>').html('Width with margins = ' + $('.my-div').outerWidth(true)).appendTo('#output');