开发者

Set inner table border in HTML

开发者 https://www.devze.com 2022-12-27 18:41 出处:网络
How do I set the \"inner border\" - the border between different cells. By setting style attributes I manage to control the outer border, but the inner border just stays the same gray color and the s

How do I set the "inner border" - the border between different cells.

By setting style attributes I manage to control the outer border, but the inner border just stays the same gray color and the sa开发者_Go百科me width. What attributes should I tweak to control the inner border?


For ordinary table markup, here's a short solution that works on all devices/browsers on BrowserStack, except IE 7 and below:

table { border-collapse: collapse; }

td + td,
th + th { border-left: 1px solid; }
tr + tr { border-top: 1px solid; }

For IE 7 support, add this:

tr + tr > td,
tr + tr > th { border-top: 1px solid; }

A test case can be seen here: http://codepen.io/dalgard/pen/wmcdE


You need to style the <td> element.

Take a look at the W3C website

0

精彩评论

暂无评论...
验证码 换一张
取 消