insert a page break in the document for printing purposes. : media « Style Basics « HTML / CSS






insert a page break in the document for printing purposes.

  

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css" media="print">
* .page-break-before {
  page-break-before: always;
}

* .page-break-after {
  page-break-after: always;
}
</style>
</head>
<body>
  <div class="page-break-after">Page break after this element. </div> 
  <div class="page-break-after">Page break after this element. </div> 
  <div class="page-break-before">Page break before this element.</div> 

</body>
</html> 

   
  








Related examples in the same category

1.The media attribute lets you control what styles are applied to whichmedia.
2.media="all"
3.media="Screen"
4.insert a page break before an element by using page-break-before:always
5.Link two style files, one for screen, one for print
6.these rules will only apply when printing
7.Language ISO subcode
8.The media attribute lets you control what styles are applied to which media.