Fighting the Space Between Inline Block Elements

Chris Coyier:

This isn’t a „bug“ (I don’t think). It’s just the way setting elements on a line works. You want spaces between words that you type to be spaces right? The spaces between these blocks are just like spaces between words. That’s not to say the spec couldn’t be updated to say that spaces between inline-block elements should be nothing, but I’m fairly certain that is a huge can of worms that is unlikely to ever happen.

Here’s some ways to fight the gap and get inline-block elements sitting directly next to each other.

I often fought with the alignment of inline-block elements myself. Chris has some solutions for the „gap problem“, but I think I rather stay with floating elements if possible in any way. It seems like much cleaner and more sustainable code to me.

Kommentare

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.