Sometimes, we want to remove the space between inline/inline-block elements with CSS.
In this article, we’ll look at how to remove the space between inline/inline-block elements with CSS.
How to remove the space between inline/inline-block elements with CSS?
To remove the space between inline/inline-block elements with CSS, we use flexbox.
For instance, we write
<p>
<span> Foo </span>
<span> Bar </span>
</p>
to add some elements.
Then we write
p {
display: flex;
}
to make the p element a flex container with display: flex;
.
Now the spans won’t have gaps between them.
Conclusion
To remove the space between inline/inline-block elements with CSS, we use flexbox.