Meta Post - Common CSS Hacks

If you want to have a page break on PDF export when you put ---, it’s for you :

@media print {
  hr {
	  break-after:page;
	  visibility: hidden;
  }
}

Also, I try to use break-after:avoid but, it doesn’t seems to work… So, I use that instead:

@media print {
  h1:after, h3:after, h2:after, h4:after, h5:after, h6:after{
     content: "";
    display: block;
    height: 100px;
    margin-bottom: -100px;
	}	
}

It prevents (most of the time) to have an H2/H3/H1 in the end of the page.

4 Likes