We all know the ages old problem with white spaces between inline-block elements. For example:
.wrapper div {width:100px; height:30px; display:inline-block; border:1px solid #333;}
<div class="wrapper">
<div></div>
<div></div>
<div></div>
<div></div>
</div>
The best solution in my opinion is to remove any spaces between the elements:
.wrapper div {width:100px; height:30px; display:inline-block; border:1px solid #333;}
<div class="wrapper">
<div>
</div><div>
</div><div>
</div><div>
</div>
</div>
Can we do this on a ready HTML with javascript/jQuery, like adding a script to the first snippet to behave like the second one? Some sort of a $('.wrapper').minify(); function.
EDIT
Someone suggested a possible duplicate with How to minify HTML with CSS and Javascript?. That question is about reducing page size by editing files on server side. Here I'm looking for a solution that minifies a specific element after the content is transferred, without editing the html files. The problem is not page size, but white spaces in an element.
.wrapper div {margin:0 -.125em}which is not always a good solution.