tags:

views:

114

answers:

3

How to reduce gap between two display:inline items?

gap is showing on all browser?

ul.tabs li {
display:inline;
margin:0 padding:0;}

alt text

I can fix the problem using float:left in the LI elements but I need to understand why it's happening.

+1  A: 

... but I need to understand why it's happening.

You may have whitespace or new lines between your inline elements.


For further reading, you may want to check out the following Stack Overflow post:

Daniel Vassallo
A: 

Reduce the word-spacing CSS property to less than 1em.

+3  A: 

You have whitespace between your inline elements. float: left fixes the problem, because floating implicitely converts the element to a block element, regardless of display: inline.

And you need a ; between margin:0 and padding: 0.

Residuum