The problem is in display:inline-block
- it reduces the elements to inline blocks, meaning they behave like all other inline content in HTML. Since there's whitespace between the anchor elements, which as always collapses to a single whitespace, what you see is an actual 'space' in between in the current font size just like between words in a sentence. You can fix this by applying font-size:0
on the container but that's messy since you'd have to reset it for the children. Recommended method is to just use float:left
instead and manually set the parent's size correctly, and set the items to height:100%
.
Using multiple elements with the same ID is wrong but not causing this issue - should still be fixed though.