Any way css select all EXCEPT on the first page?

I just found the CSS @page directive and used it with :first to apply CSS to the first page of the html print. Is there a way to go the other way around and apply CSS to all pages except the first?

+4
source share
3 answers

Use CSS3 :not() :

 @page :not(:first) { } 

If you need better browser compatibility, then the Donut solution for styling everything that "cancels" them for :first also works (based on specificity / cascade).

 @page { /* Styles for everything but the first page */ } @page :first { /* Override with perhaps your stylesheet defaults */ } 
+9
source

If you use CSS2, you can do it indirectly. Use @page to set the style you want for all of your pages except the first, then use @page along with :first to β€œcancel” these styles for the first page.

+3
source

Can be done with javascript / jquery.

Negative CSS selectors

0
source

Source: https://habr.com/ru/post/1332800/


All Articles