"; 2. Add "display: none;" to the table element tr, th or td; "style."/> "; 2. Add "display: none;" to the table element tr, th or td; "style.">

Home  >  Article  >  Web Front-end  >  How to hide content in HTML table

How to hide content in HTML table

青灯夜游
青灯夜游Original
2021-12-14 15:58:177746browse

Methods to hide content in HTML tables: 1. Set the hidden attribute to table elements tr, th or td, with the syntax "

How to hide content in HTML table

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

We have the following table:

<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>
	<tr>
		<td>Lois</td>
		<td>20</td>
	</tr>
	<tr>
		<td>Peter</td>
		<td>20</td>
	</tr>
</table>

How to hide content in HTML table

How to hide the content of the HTML table? Here are several methods to introduce to you.

1. Set the hidden attribute to the table element

<table border="1">
	<tr>
		<th>姓名</th>
		<th>年龄</th>
	</tr>
	<tr hidden="hidden">
		<td>Peter1</td>
		<td>20</td>
	</tr>
	<tr>
		<td>Lois1</td>
		<td hidden="hidden">20</td>
	</tr>
	<tr>
		<td>Peter2</td>
		<td>20</td>
	</tr>
	<tr>
		<td>Lois2</td>
		<td>20</td>
	</tr>
	
</table>

How to hide content in HTML table

2. Add display: none;Style

<table border="1">
	<tr>
		<th>姓名</th>
		<th>年龄</th>
	</tr>
	<tr>
		<td>Peter1</td>
		<td style="display: none;">20</td>
	</tr>
	<tr style="display: none;">
		<td>Lois1</td>
		<td>20</td>
	</tr>
	<tr>
		<td>Peter2</td>
		<td>20</td>
	</tr>
	<tr>
		<td>Lois2</td>
		<td>20</td>
	</tr>
</table>

How to hide content in HTML table

Recommended tutorial: "html video tutorial"

The above is the detailed content of How to hide content in HTML table. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn