html
1<body> 2<div id="header"> 3 <input type="button" id="save" value="上書き保存" > 4</div> 5<div id="main"> 6</div> 7<textarea id="workspace"> 8 </textarea> 9 <input type="button" value="印刷"> 10 11<script> 12Array.prototype.forEach.call(document.getElementsByTagName('input'), function(elm){ 13 elm.addEventListener('click',function(e){ 14 this.previousElementSibling.classList.add('print'); 15 window.print(); 16 this.previousElementSibling.classList.remove('print'); 17 }) 18}); 19</script> 20</body>
css
1#main{ 2 text-align:center; 3 padding:1em; 4 background-color: #DCDCDC; 5 height:50em; 6 position:relative; 7} 8a{ 9 text-decoration: none; 10 color:black; 11} 12#workspace{ 13 position:absolute; 14 top:5em; 15 left:30em; 16 background-color: white; 17 width:525px; 18 height:742.5px; 19 border: 1px solid gray; 20} 21@media print{ 22 body :not(.print) { 23 display:none; 24 } 25}
これで印刷ボタンをおしても、小さく印刷されてしまいます。大きく印刷するにはどうすればいいのでしょうか。。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。