css set a4 paper size
HTML
<div class="book"> <div class="page"> <div class="subpage">Page 1/2</div> </div> <div class="page"> <div class="subpage">Page 2/2</div> </div> </div>
CSS
body { margin: 0; padding: 0; background-color: #FAFAFA; font: 12pt "Tahoma"; } * { box-sizing: border-box; -moz-box-sizing: border-box; } .page { width: 21cm; min-height: 29.7cm; padding: 2cm; margin: 1cm auto; border: 1px #D3D3D3 solid; border-radius: 5px; background: white; box-shadow: 0 0 5px rgba(0, 0, 0, 0.1); } .subpage { padding: 1cm; border: 5px red solid; height: 256mm; outline: 2cm #FFEAEA solid; } @page { size: A4; margin: 0; } @media print { .page { margin: 0; border: initial; border-radius: initial; width: initial; min-height: initial; box-shadow: initial; background: initial; page-break-after: always; } }
相关推荐
myloveqiqi 2020-08-09
AlisaClass 2020-07-19
大象从不倒下 2020-07-31
猫沙盆 2020-07-08
猫沙盆 2020-07-07
云端漂移 2020-07-06
xiaohuli 2020-06-11
葉無聞 2020-06-09
淡风wisdon大大 2020-06-06
福叔 2020-06-02
CaiKanXP 2020-06-02
opspider 2020-05-29
guicaizhou 2020-05-06
jiangfulai 2020-04-11
buttonChan 2020-04-10
jiedinghui 2020-02-20