Home  >  Article  >  Web Front-end  >  How to Prevent Href Attributes from Printing in Chrome?

How to Prevent Href Attributes from Printing in Chrome?

Susan Sarandon
Susan SarandonOriginal
2024-10-31 07:04:30210browse

How to Prevent Href Attributes from Printing in Chrome?

Eliminating Href Attributes during Chrome Printing: A CSS Customization

Many users encounter an issue when customizing print CSS in Chrome: href values are printed alongside the hyperlink text. To resolve this problem, implement the following solution:

Bootstrap CSS includes a print mode rule that appends the href value after the link text:

<code class="css">@media print {
  a[href]:after {
    content: " (" attr(href) ")";
  }
}</code>

To remove the href display, modify the print stylesheet:

<code class="css">@media print {
  a[href]:after {
    content: none !important;
  }
}</code>

This modification overrides the Bootstrap rule, ensuring that only the link text is printed.

The above is the detailed content of How to Prevent Href Attributes from Printing 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