JSFiddle - React, Tailwind, and code Playground

by JohnJ

HTML

<div class="container">
    <div class="element"></div>
    <div class="element last"></div>
</div>

<div id="debug"></div>

CSS

.container {
    width: 100px;
    height: 100px;
    background-color: green;
}
.element {
    width: 45.01px; /* 45.001 = 45 */
    height: 50px;
    background-color: blue;
    float: left;
}
.last {
    margin-left: 10px;
}

JavaScript

// firefox display .element as 45px of width, but calc width as 45.01px
$(document).ready(function () {
    $('.element').each(function() {
        log('widths', this.clientWidth + 'px, ' + this.offsetWidth + 'px, ' + this.scrollWidth + 'px');
    });
});
        
function log(key, value) {
    $('#debug').append(key + ': ' + value + '<br />');
}