html – 如何在tr标签周围放置边框?

我有一个非常简单的html页面:
<table>
     <tr><th>header1</th><th>header2</th></tr>
     <tr><td>item1</td><td>item2</td></tr>
     <tr><td>item3</td><td>item4</td></tr>
</table>

用一些简单的css:

tr
{
    border:1px solid blue;
}

我希望这可以在trs周围放置一个边框,但是它根本不会在其周围放置边框.我如何得到一个边界?

解决方法

添加表{border-collapse:collapse; }.

the CSS2 specification

In [the border-collapse: separate model],each cell has an individual border. […] Rows,columns,row groups,and column groups cannot have borders (i.e.,user agents must ignore the border properties for those elements).

相关文章

HTML代码中要想改变字体颜色,常常需要使用CSS样式表。CSS是...
HTML代码如何让字体盖住图片呢?需要使用CSS的position属性及...
HTML代码字体设置 在HTML中,我们可以使用标签来设置网页中的...
在网页设计中,HTML代码的字体和字号选择是非常重要的一个环...
HTML(Hypertext Markup Language,超文本标记语言)是一种用...
外链是指在一个网页中添加一个指向其他网站的链接,用户可以...