Вопрос

How can I get page-break-after to work on a div that I am showing as display:none with @media screen?

I want the image to only show when I print but also page break after it so the rest of the divs print onto the second page.

EXAMPLE

this is the result I'm getting:

enter image description here

Это было полезно?

Решение


In your current CSS you have:

@media screen { .image { display:none; } }

@media print { .image { break-after:always;} }

.one { width:200px; height:100px; background-color:#339999;}

Where you have:

     @media print { .image { break-after:always;} }

Try changing this to:

     @media print { .image { page-break-after:always;} }

Hope this works.

Другие советы

This is for other people watching this review.
The new css file, I deleted my download link so here it is:

.image { display:none;}

@media print 
{ 
.image { page-break-after:always; display:table;} 
.one {display:table;}
}

.one { width:200px; height:100px; background-color:#339999;}
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top