CSS隐藏表格列以供打印 [英] CSS hide table column for print

查看:55
本文介绍了CSS隐藏表格列以供打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有表数据,最后一列包含对该数据进行操作的链接.我希望有人打印页面时最后一列不可见.

I have table data and last column contains links for actions on that data. I would like that last column not visible when someone prints the page.

我尝试了以下操作,并且可以在屏幕上使用(看不到最后一列,其余各列均匀分布以填充该空间).

I tried the following and it works on screen (don't see last column, and rest of the columns are evenly spread to fill that space).

@media print {
  table td:last-child {display:none}
}

但是它不适用于打印:我看不到该列,但该列有空白.

But it doesn't work for print: I don't see the column, but there is empty space where it was.

推荐答案

这对我有用:

   @media print {
       table td:last-child {display:none}
       table th:last-child {display:none}
   }

这篇关于CSS隐藏表格列以供打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆