How to Prevent Href Attributes from Printing in Chrome?

Susan Sarandon
Release: 2024-10-31 07:04:30
Original
225 people have browsed it

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>
Copy after login

To remove the href display, modify the print stylesheet:

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

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!

source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!