html怎么把表格隐藏(html如何将表格边框隐藏起来打印)

lxf2023-03-16 12:34:01

html将表格边框隐藏的方法:1、使用style属性给table、th、td元素添加“border: none;”样式;2、使用style属性给table元素添加“border-color: transparent;”样式。

html怎么把表格隐藏(html如何将表格边框隐藏起来打印)

本教程操作环境:windows7系统、CSS3&&HTML5版、Dell G3电脑。

我们有下面一个表格:

<table border="1">
	<tr>
		<th>姓名</th>
		<th>年龄</th>
	</tr>
	<tr>
		<td>Peter</td>
		<td>20</td>
	</tr>
	<tr>
		<td>Lois</td>
		<td>20</td>
	</tr>
</table>

html怎么把表格隐藏(html如何将表格边框隐藏起来打印)

怎么将这个表格的边框隐藏起来?下面介绍一下方法:

1、给table、th、td元素添加border: none;样式

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
	</head>

	<body>
<table border="1" style="border: none;">
	<tr>
		<th  style="border: none;">姓名</th>
		<th  style="border: none;">年龄</th>
	</tr>
	<tr>
		<td style="border: none;">Peter</td>
		<td style="border: none;">20</td>
	</tr>
	<tr>
		<td style="border: none;">Lois</td>
		<td style="border: none;">20</td>
	</tr>
</table>
	</body>
</html>

html怎么把表格隐藏(html如何将表格边框隐藏起来打印)

2、给table元素添加border-color: transparent;样式

<table border="1" style="border-color: transparent;">
	<tr>
		<th>姓名</th>
		<th>年龄</th>
	</tr>
	<tr>
		<td>Peter</td>
		<td>20</td>
	</tr>
	<tr>
		<td>Lois</td>
		<td>20</td>
	</tr>
</table>

html怎么把表格隐藏(html如何将表格边框隐藏起来打印)

推荐教程:《html视频教程》

以上就是html怎么将表格边框隐藏的详细内容,更多请关注AdminJS其它相关文章!