@Page使用方式

css @Page

@Page

CSS at-rule is used to modify some CSS properties when printing a document.

用於列印格式設定,其中size中可設定landscape(橫式)/portrait(直式)

測試範例:

<style>
   @page{
  size: A4 landscape;
  margin: 0.5cm;
  orphans:4;
  widows:2;
}
</style>

<script>
    print();
</script>

Reference: