The display: inline-block; property in IE seems have padding and margin that I can’t clear no matter what I try and do. Has anyone else encountered this bug and knows how to fix it?
The display: inline-block; property in IE seems have padding and margin that I can’t
Share
It’s most likely because you have at least one space or linebreak between the
inline-blockelement tags in your markup.Linebreaks will be converted to a single space between
inline-blockelements. So the extra space you’re seeing is not padding or margin, but an actual space character in the text of the containing element.There are a few workarounds:
UglifyChange your markup to remove or reposition the linebreaks:Use
float: leftorfloat: rightto display your block elements inline instead ofinline-block. Note that this will introduce other issues, like having to ensure that the containing element is clearfixed.Set
word-spacing: -1emon the containing element. Note that if yourinline-blockelements contain any text, and you don’t want this text to have wonky word spacing, you’ll need to override the inherited rule withword-spacing: normalon the inline elements. Demo: http://jsbin.com/ucivel/1/edit