@page
@page规则允许你指定页面盒子的许多方面。
语法
@page <page-selector-list> { <page-body> } where <page-selector-list> = [ <page-selector># ]? <page-body> = <declaration>? [ ; <page-body> ]? | <page-margin-box> <page-body> where <page-selector> = <pseudo-page>+ | <ident> <pseudo-page>* <page-margin-box> = <page-margin-box-type> { <declaration-list> } where <pseudo-page> = : [ left | right | first | blank ] <page-margin-box-type> = @top-left-corner | @top-left | @top-center | @top-right | @top-right-corner | @bottom-left-corner | @bottom-left | @bottom-center | @bottom-right | @bottom-right-corner | @left-top | @left-middle | @left-bottom | @right-top | @right-middle | @right-bottom
例子
HTML
<div class="stage">appearance</div>
CSS
//规则指定默认页面尺寸是5.5*8.5英尺。如果你想打印一本书。 @page { size: 5.5in 8.5in; } //纸质尺寸关键字 @page { size: A4; } //页面方向 - ““portrait””或“landscape” @page { size: A4 landscape; }