CSS: borders between table columns only

前端 未结 10 1603
有刺的猬
有刺的猬 2020-12-07 20:11

Is there a way, using CSS, to show borders in a table between columns only (not on the outer edges)?

10条回答
  •  心在旅途
    2020-12-07 20:37

    Borders on tables are always a bit flaky. One possibility would be to add a border-right declaration to each table cell except for the ones in right-most column. If you're using any kind of table-spacing this won't work very well.

    Another option would be to use a 1px high background image with the borders inside it, but that'll only work if you can guarantee the width of each cell at all times.

    Another possibility is to experiment with colgroup / col. This had fairly horrible support cross-browser the last time i looked at it but could have improved since then: http://www.webmasterworld.com/forum83/6826.htm

提交回复
热议问题