JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container">
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
CSS
ul {
width: 100px;
}
li {
background: red;
width: 20px;
height: 100px;
display: inline-block;
margin: 0;
padding: 0;
}
JavaScript
jQuery.fn.cleanWhitespace = function() {
textNodes = this.contents().filter(
function() { return (this.nodeType == 3 && !/\S/.test(this.nodeValue)); })
.remove();
return this;
}
$('.container').cleanWhitespace();