如何取消table表格之间的空隙

作者:分开不是尽头 | 创建时间: 2023-07-23
如何取消table表格之间的空隙...
如何取消table表格之间的空隙

操作方法

新建html文件

插入表格

插入表格代码

插入表格视图模式

定义表格宽度并在表格中添加数据

浏览器预览效果如图,这是表格之间有很大空隙,边框明显不是1px怎样去除边框之间的空隙呢

添加样式style="border-collapse:collapse;"去除表格边框之间的间隙

最终预览效果如图附上代码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> </head> <body> <table width="500px" border="1" style="border-collapse:collapse;"> <tr> <td>1</td> <td>2</td> <td>2</td> </tr> <tr> <td>4</td> <td>5</td> <td>6</td> </tr> <tr> <td>7</td> <td>8</td> <td>9</td> </tr> </table> </body> </html>

温馨提示

如果没有指定 !DOCTYPE border-collapse 属性在 IE8 及更早 IE 版本中是不起作用的。
点击展开全文

更多推荐