How to get rid of white space between css horizontal list items?

This question already has an answer here:

  • Why is there an unexplainable gap between these inline-block div elements? 6 answers
  • How do I remove the space between inline-block elements? 32 answers

  • You need to use display:block and float:left on the li s to remove the space. When they're inline the browser treats them as words, and so leaves space in between.

    Also see my similar question.


    Combine @Skilldrick and @teedyay and you have your answer and explanation.
    If <li> s are treated as words than any white space around them is condensed to one space.

    So I guess this is a feature that looks like a bug.

    To remove the space either put all your <li> s in a chain with no white space between them.
    OR
    Reduce the font size on the <ul> to 0 and restore the size on the <li> s


    您还可以为<ul>标签设置font-size:0

    链接地址: http://www.djcxy.com/p/89268.html

    上一篇: 无法摆脱内联之间的空间

    下一篇: 如何摆脱CSS水平列表项目之间的空白?