如何在HTML中创建打印链接?可以通过三步来实现打印按钮:
步骤1:复制你的css文件用于打印视图,并将媒体类型的属性“all”更改为“print”:
<link rel="stylesheet" href="print.css" type="text/css" media="print">
步骤2:创建如下按钮:
<a href="#" id="print-button" onclick="window.print();return false;">Print this page</a>
第三步:添加css样式
#print-button { display: none; }
在打印视图中不需要打印按钮。我们隐藏那个按钮。
