DEV Community

loading...

Discussion on: Default 4px spacing between inline elements

Collapse
nektro profile image
Meghan (she/her) • Edited

My typical answer to this problem is using flexbox.

From the CSS Tricks article, with the css

nav a {
  display: inline-block;
  padding: 5px;
  background: red;
}

if you turn the CSS into the following you get the same result :D

nav {
  display: flex;
}
nav a {
  padding: 5px;
  background: red;
}

Collapse
tyzia profile image
Andrei Navumau Author

Thank you, Sean. I've added this method into my post.

Forem Open with the Forem app