Last active
March 1, 2017 11:04
-
-
Save yinxianwei/fd116450a2a2c6dbd4ec8a016918bedf to your computer and use it in GitHub Desktop.
热敏打印机字号大小无法调整问题
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta name="renderer" content="webkit"> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<title>美问</title> | |
<style type="text/css"> | |
@media screen { | |
#printSection { | |
display: none; | |
} | |
} | |
@page { | |
margin: 0cm; | |
} | |
@media print { | |
body * { | |
visibility: hidden; | |
} | |
#printSection * { | |
visibility: visible; | |
} | |
p { | |
font-size: 9pt; | |
} | |
h4 { | |
font-size: 18pt; | |
} | |
} | |
</style> | |
<script type="text/javascript"> | |
function printTest() { | |
window.print(); | |
} | |
</script> | |
</head> | |
<body> | |
<div> | |
<div id="printSection"> | |
<div style="width: 150%;height: 1px;"></div> | |
<!-- 如果打印内容宽度过短,则需要添加宽度大于100%的div,否则字体大小设置无效 --> | |
<p>打印测试</p> | |
<h4>打印测试</h4> | |
</div> | |
<button onclick="printTest()">打印</button> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment