Eliminate gap between tbody tags

前端 未结 2 933
孤城傲影
孤城傲影 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:18

    Looks like adding border-spacing: 0; to your table elements will help. Without this, there's 2 pixels surrounding each of the borders, which means there's 4 pixels between the tables.

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题