目录

style borderCollapse 属性

示例

折叠表格边框:

document.getElementById("myTable").style.borderCollapse = "collapse";
亲自试一试 »

下面有更多 "亲自试一试" 示例。


描述

borderCollapse 属性设置或返回表格边框是否应折叠为单个边框。


浏览器支持

表中的数字指定完全支持该属性的第一个浏览器版本。

Property
borderCollapse 1.0 5.0 1.0 1.2 4.0

语法

返回 borderCollapse 属性:

object.style.borderCollapse

设置 borderCollapse 属性:

object.style.borderCollapse = "separate|collapse|initial|inherit"

属性值

Value Description
separate Separate borders are drawn for all table cell elements. This is default
collapse Borders are not drawn between table cell elements
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit


技术细节

默认值: 分离
返回值: 一个字符串,代表表格的边框
CSS版本 CSS2

更多示例

示例

返回 borderCollapse 属性:

alert(document.getElementById("myTable").style.borderCollapse);
亲自试一试 »

相关页面

CSS教程:CSS表

CSS 参考:边框折叠属性