我正在使用java脚本打印html页面中的选定区域..我使用@MEDIA print { ..隐藏页面中的所有标题、按钮和图像。它被隐藏了,但仍然留有空白空间。如何对齐打印内容以从页面顶部打印..
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<style type="text/css">
@MEDIA print {
#top_part{
visibility:hidden;
}
#print{
margin-top: 5px;
}
}
</style>
</head>
<body>
<div id="top_part">
<button onclick="window.print();">print</button>
hello <br/>
<br/><br/><br/><br/><br/>
test if the printer avoids this content
<br/>
打印这个..
</body>
</html>
在代码中,div top_part 包含我需要隐藏的按钮和文本,它隐藏了,但如何从打印的顶 Angular 对齐可打印区域
最佳答案
尝试
@MEDIA print {
#top_part{
display:none;
}
关于javascript - html @MEDIA print {},隐藏标记,在打印中留下空白,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18433421/