Home > OS >  How can spaces be removed in HTML output?
How can spaces be removed in HTML output?

Time:02-07

Here's my HTML code in a markdown editor:

<div>

This is some text

<emb>Reference:<emb>
    <ol>
        <li><i>Reference link #1</i></li>
        <li><i>Reference link #2</i></li>
    </ol>
</div>

This is some text.

<style>
  emb {
       font-weight: 500;
       background: transparent;
       font-size: 18px
    }
</style>

It produces result as below:


enter image description here

What causes this space?

CodePudding user response:

Margins of elements. You can use CSS to remove them like this:

<p style="margin-bottom: 0;"> <emb> Reference: </emb> </p>

and on ol

<ol style="margin-top: 0;">

I had to remove both margins on <p> and on <ol> to remove the space
You can also use inspect element on browsers to see the answer.

CodePudding user response:

You can remove space between any two tags by simply using margin-bottom property.

  •  Tags:  
  • Related