gpt4 book ai didi

javascript - 如何从打印中删除 url(在浏览器中)

转载 作者:太空宇宙 更新时间:2023-11-03 22:50:51 26 4
gpt4 key购买 nike

我正在用 C# 打印 html 页面。在我用过的打印功能中

OnClientClick="window.print();return false;"
  1. 但打印件与 header 中的 url 一起出现。如何删除此网址?
  2. 我在页面中有一个打印按钮,该按钮也出现在打印中。如何删除它?

我正在使用 CSS 2.0,因此需要 CSS 2.0 的解决方案。

谢谢

最佳答案

只需在 css 中使用打印媒体查询来隐藏按钮:

@media print {
#button-id{
display: none; /* This will hide your print button in print view */
}
@page {
size: auto; /* auto is the initial value */
margin: 0; /* this affects the margin in the printer settings */
}
}

关于javascript - 如何从打印中删除 url(在浏览器中),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47389563/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com