April 17, 2012

Table breaks when printing

Question by iceteea

I have a site with some tables on it (with thead & tbody).
This site shall be printed with the latest firefox.
Problem: sometimes firefox breaks the page within one of the tables,
the printed version of the site is unusable.
Couldn’t find any working solution yet.

Answer by Starx

This shall fix the problem

table { 
   page-break-before: always;
} 

Update::

On that case, use the folloing

@media print {
    table {
       page-break-inside:avoid;
    }
}

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!