在 Chrome 中打印时需要删除 href 值 [英] Need to remove href values when printing in Chrome

查看:13
本文介绍了在 Chrome 中打印时需要删除 href 值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试自定义打印 CSS,发现它打印出带有 href 值和链接的链接.

I'm attempting to customize the print CSS, and finding that it prints links out with the href value as well as the link.

这是在 Chrome 中.

This is in Chrome.

对于这个 HTML:

<a href="http://www.google.com">Google</a>

它打印:

Google (http://www.google.com)

我希望它打印:

Google

推荐答案

Bootstrap 做同样的事情(...作为下面选择的答案).

Bootstrap does the same thing (... as the selected answer below).

@media print {
  a[href]:after {
    content: " (" attr(href) ")";
  }
}

只需从那里删除它,或在您自己的打印样式表中覆盖它:

Just remove it from there, or override it in your own print stylesheet:

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

这篇关于在 Chrome 中打印时需要删除 href 值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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