markdown
### 換頁的 CSS 相關設定
```css
page-break-before: auto|always|avoid|left|right|initial|inherit;
page-break-after: auto|always|avoid|left|right|initial|inherit;
page-break-inside: auto|avoid|initial|inherit;
```
在標籤前或後換頁
```css
@media print {
  /* 在標籤前換頁 */
  h1 { page-break-before: always; }
  /* 在標籤後換頁 */
  footer { page-break-after: always; }
}
```
避免在文中換頁 `page-break-inside: avoid;`
```css
@media print {
  /* 避免標籤內換頁 */
  pre, blockquote { page-break-inside: avoid; }
}
```
### References
- https://www.w3schools.com/cssref/pr_print_pageba.asp
沒有留言:
張貼留言