【发布时间】:2018-08-30 00:27:33
【问题描述】:
如何在打印模式下隐藏整个表格列(使用 JS javascript:print())?
因为我使用的是 Bootstrap,所以我尝试了它的 .hidden-print 类在打印模式下隐藏最后一列(操作列):
<table class="table table-striped">
<thead>
<tr>
<th>No</th>
<th>Name</th>
<th class="hidden-print">Operation</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>John Smith</td>
<td class="hidden-print">
<a href="edit.php" role="button" class="btn">Edit</a>
<a href="delete.php" role="button" class="btn">Delete</a>
</td>
</tr>
<tr>
<td>2</td>
<td>Neo</td>
<td class="hidden-print">
<a href="edit.php" role="button" class="btn">Edit</a>
<a href="delete.php" role="button" class="btn">Delete</a>
</td>
</tr>
<tr>
<-- continued -->
</tr>
</tbody>
</table>
但它只是隐藏列的内容,显示没有内容的列,当我需要时它还隐藏了 TH 和 TD 标签。
可以这样做吗?
【问题讨论】: