Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to make HTML layout whitespace-agnostic?
    primarykey
    data
    text
    <p>EDIT: <i>There is the almost same question at <a href="https://stackoverflow.com/questions/1097006/removing-whitespace-between-html-elements-when-using-line-breaks">Removing whitespace between HTML elements when using line breaks</a> , however apart from "float" suggestion I find none of the answers suitable for my requirements. I'd like this to stay open for more innovative suggestions</i></p> <p>If you have consecutive <code>inline-block</code>s 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? </p> <p>Example: </p> <pre><code>&lt;span&gt;a&lt;/span&gt; &lt;span&gt;b&lt;/span&gt; </code></pre> <p>This renders differently than:</p> <pre><code>&lt;span&gt;a&lt;/span&gt;&lt;span&gt;b&lt;/span&gt; </code></pre> <p>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. </p> <p>I think these options are ugly:</p> <p>1) Tweaking <code>text-indent</code>, <code>margin</code>, <code>padding</code> etc. (Because it would be dependent on font-size, default white-space width etc)</p> <p>2) Putting everything on a single line, next to each other. </p> <p>3) Zero <code>font-size</code>. That would require overriding font-size in blocks, which would otherwise be inherited.</p> <p>4) Possible document-wide solutions. I want the solution to stay local for a certain block of HTML.</p> <p>Any ideas, any obvious points which I'm missing?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload