How to make HTML layout whitespace-agnostic?
- by ssg
If you have consecutive inline-blocks white-space becomes significant. It adds some level of space between elements. What's the "correct" way of avoiding whitespace effect to HTML layout if you want those blocks to look stuck to each other?
Example:
<span>a</span>
<span>b</span>
This renders differently than:
<span>a</span><span>b</span>
because of the space inbetween. I want whitespace-effect to go away without compromising HTML source code layout. I want my HTML templates to stay clean and well-indented.
I think these options are ugly:
1) Tweaking text-indent, margin, padding etc. (Because it would be dependent on font-size, default white-space width etc)
2) Putting everything on a single line, next to each other.
3) Zero font-size. That would require overriding font-size in blocks, which would otherwise be inherited.
4) Possible document-wide solutions. I want the solution to stay local for a certain block of HTML.
Any ideas, any obvious points which I'm missing?