JSFiddle - React, Tailwind, and code Playground
HTML
<div class="parentDiv">
<div class="container">
<div class="childDiv">
</div>
<div class="childDiv"></div>
</div>
</div>
CSS
.parentDiv {
background-color:red;
display:block;
height:200px;
width:450px;
text-align: center;
}
.container {
padding-top: 80px;;
width:250ppx;
}
.childDiv {
display:inline-block;
background-color:yellow;
width: 100px;
height: 35px;
margin:0;
padding: 0;
}
JavaScript
jQuery.fn.clearWhiteSpace = function () {
var htmlClone = this.html().replace(/\n[ ]*/g,"");
this.html(htmlClone);
return this;
}
//try without cleaning the spaces and you will see the black magic
$(".parentDiv").clearWhiteSpace();