How to remove the space between inline or inline-block elements with CSS?

Spread the love

Sometimes, we want to remove the space between inline or inline-block elements with CSS.

In this article, we’ll look at how to remove the space between inline or inline-block elements with CSS.

How to remove the space between inline or inline-block elements with CSS?

To remove the space between inline or inline-block elements with CSS, we use flexbox.

For instance, we write

ul {
  display: -webkit-box;
  display: -moz-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
}

to make the ul element a flex container with display: flex;.

Then the li elements inside the ul element will be displayed side by side.

Conclusion

To remove the space between inline or inline-block elements with CSS, we use flexbox.

Leave a Reply

Your email address will not be published. Required fields are marked *