Hide Columns | Tables
You can hide columns with the visibility: collapse
property:
<!DOCTYPE html>
<html>
<head>
<title>Hide Columns</title>
<style>
table, th, td {border: 1px solid black;border-collapse: collapse;}
</style>
</head>
<body>
<h2>Hide Columns</h2>
<p>You can hide specific columns with the visibility property:</p>
<table style="width: 100%;">
<colgroup>
<col span="1">
<col span="1" style="visibility: collapse">
</colgroup>
<tr>
<th>#</th>
<th>Name of Student</th>
<th>Class</th>
</tr>
<tr>
<td>1.</td>
<td>Taranpreet Singh</td>
<td>6th</td>
</tr>
<tr>
<td>2.</td>
<td>Mehakpreet Kaur</td>
<td>7th</td>
</tr>
<tr>
<td>3.</td>
<td>Veerpal Kaur</td>
<td>8th</td>
</tr>
<tr>
<td>4.</td>
<td>Jasmeen</td>
<td>9th</td>
</tr>
<tr>
<td>5.</td>
<td>Sonia</td>
<td>10th</td>
</tr>
<tr>
<td>6.</td>
<td>Jaskaran Singh</td>
<td>11th</td>
</tr>
<tr>
<td>7.</td>
<td>Arshdeep Kaur</td>
<td>12th</td>
</tr>
</table>
<p><b>Note:</b> The table columns does not collapse properly in Safari browsers.</p>
</body>
</html>