How does span element spacing work?

Asked

Viewed 206 times

0

Depending on how I write the code, the span element puts a spacing.

<div style="padding:20px; border:1px solid black; margin-bottom:16px;">
        <span>1</span><span>2</span><span>3</span>
</div>

<div style="padding:20px; border:1px solid black;">
        <span>1</span>
        <span>2</span>
        <span>3</span>
</div>

If you write span side by side it does not put a space between words. How do I make for the second div that has the broken spans to have the same result as the first?

  • I understood how this spacing works. Now I can’t find out how I can solve this.

  • @Heberleonard, I was going to answer here, but as it is duplicated even (I had not noticed the comments), I put a another answer there. :)

  • Hello Heber, you can settle with float or with font-size:0 in the parent element, see in detail how to do at: https://answall.com/a/172077/3635 or else using HTML comments <!-- -->, see how it is with: https://answall.com/a/172266/3635

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.