Eliminate gap between tbody tags

前端 未结 2 939
孤城傲影
孤城傲影 2021-02-15 14:05

Is there a way to eliminate the slight gap between two tbody tags when they are both displayed inline like this?

http://jsfiddle.net/kttss/

2条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-15 14:19

    Use float instead of inline-block display. You also have to collapse the borders with border-collapse:collapse, or use border-spacing: 0 as in @JoeEnos's answer, as well.

    table { border-collapse:collapse; }
    tbody { float:left; }
    

    Demo

    With display: inline-block, the white-space in the markup (line-breaks, tabs) are collapsed and rendered as a single space. floats are not affected by this.

提交回复
热议问题