CSS unwanted spacing between anchor-tag elements

Viewed 37791

I have this stylesheet:

*{
    padding: 0px;
    margin: 0px;
}

a{

  background:yellow;

}

and this webpage:

<a href="/blog/">Home</a>
<a href="/about/">About</a>
<a href="/contact/">Contact</a>    

Results in:

enter image description here

How do I make those anchor tag to "touch" each other,removing that unwanted space in-between?

thanks Luca

7 Answers

You can use flexbox:

div {
    display: flex;
}
<div>
    <a href="/blog/">Home</a>
    <a href="/about/">About</a>
    <a href="/contact/">Contact</a>   
</div>

Or if you use Bootstrap:

<div class="d-flex">
    <a href="/blog/">Home</a>
    <a href="/about/">About</a>
    <a href="/contact/">Contact</a>   
</div>

Related