I wondered if there is any technique that can be used to remove whitespace displaying in the browser without sacrificing readability of HTML.
For example, putting HTML on different lines (easier to read when working with it) creates unwanted whitespace between the divs/spans/li's - very frustrating. The only way I can see around this is to push all the HTML onto one line, which makes reading/editing and maintaining a nightmare.
For example see these fiddles.
Fiddle 1 has readable HTML, but the images are pushed onto a second line due to unwanted whitespace.
Fiddle 2 has HTML all on one line, frustrating to read, but the output is correct.
I'm wondering if there is anyway to get around this or is it just something I have to deal with?
To me, the following code is just not easy to work with.
<div class="prodGrid">
<div class="prod"><img src="http://www.sciencebuzz.org/sites/default/files/images/cat_0_0.jpg" alt="text" /></div><div class="prod"><img src="http://www.sciencebuzz.org/sites/default/files/images/cat_0_0.jpg" alt="text" /></div><div class="prod"><img src="http://www.sciencebuzz.org/sites/default/files/images/cat_0_0.jpg" alt="text" /></div></div>