代码之家  ›  专栏  ›  技术社区  ›  David Brierton

打印文档时隐藏链接中的文本

  •  2
  • David Brierton  · 技术社区  · 6 年前

    我正在使用打印页面按钮,并试图在文档打印时隐藏链接的(单击此处打印)部分。(它还显示表单。) (forms/IRF.cfm)

    <a href="forms/IRF.cfm" target="_blank">Initial Registration Fee Exemption Affidavit - if applicable (click here to print)</a>
    

    我试着用一类 noprint 用css隐藏它,这也不起作用。

    @media print {
          .noprint {
            display: none;
          }
        }
    
    <a href="forms/IRF.cfm" target="_blank">Initial Registration Fee Exemption Affidavit - if applicable <span class="noprint">(click here to print)</span></a>
    

    有没有一种特殊的方式来处理文本和链接?

    任何帮助都将不胜感激!

    2 回复  |  直到 6 年前
        1
  •  2
  •   ESP32    6 年前

    <style>
    @media print {
          .noprint {
            display: none;
          }
        }
    </style>
    
    <a href="forms/IRF.cfm" target="_blank">Initial Registration Fee Exemption Affidavit - if applicable <span class="noprint">(click here to print)</span></a>

    要进行测试,请单击“运行代码段”,然后右键单击链接“初始注册…”旁边的,然后选择“打印”。

        2
  •  0
  •   David Brierton    6 年前

    @media print {
    a[href]:after {
            content: none !important;
          }
    }