Home  >  Article  >  Web Front-end  >  How to Prevent Links from Printing with Their Href Values in Chrome?

How to Prevent Links from Printing with Their Href Values in Chrome?

Mary-Kate Olsen
Mary-Kate OlsenOriginal
2024-10-31 04:55:30104browse

How to Prevent Links from Printing with Their Href Values in Chrome?

Printing Without Href Values in Chrome

When attempting to customize the CSS for printing, you may encounter an issue where links are printed with their href values. This is the case in Chrome. For example, if you have the following HTML:

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

It will print as:

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

To resolve this and print only the link text, you can make use of the following CSS snippet for your printing stylesheet:

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

This will override the default behavior of Bootstrap and print links without their href values.

The above is the detailed content of How to Prevent Links from Printing with Their Href Values in Chrome?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn