Please see the following example: http://jsfiddle.net/Gv6w3/
As you can see, it's a simple example of menu items set to display:inline-block;
All I'm trying to do is get the menu items flush against each other- I have margins set to 0px, but i can't get rid of the spacing between them? What is going on??
EDIT: Just noticed duplicates, my bad: How to remove the space between inline-block elements?, display: inline-block extra margin
Approach 1: We can remove space between any two tags by simply using margin-bottom property. The margin-bottom property sets the bottom margin of an element. We will assign a negative value to the margin-bottom of a particular tag to eliminate the extra space between the tags as shown.
apply float:left and that will remove the space so the text doesn't have to be on 1 line.
put the close tag of one and the open tag of the next element on the same line:
<div class="top-menu-item">
Item 2
</div><div class="top-menu-item">
Item 3</div>
Inline elements take the whitespace that is between them and this renders as 1 space. If you put the next element directly after the previous there will be no whitespace in between and the space will be gone.
Quick redux of the problem:
inline
and inline-block
tell the browser to display an element as if it was a word. Words have spaces between them. Your options for getting rid of these spaces are:
Solutions:
All css options, forevermore: http://css-tricks.com/fighting-the-space-between-inline-block-elements/
If you can't float, an em based negative margin gets my vote.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With