2

I have placed in my CSS code setting for @page:first and @page as they require different footer details.

However what I need to do is alter settings for page 2 specifically as this page by design will be blank.

I need to update the second page to have no footer details. Is this something that can be done?

 @page:first{
    margin-top: 50px;
    margin-bottom:50px;
    margin-left: 50px;
    margin-right: 50px;
    content:counter(page);
    @bottom-right {
        content: element(footer2);
        }
}

@page{
    margin-top: 50px;
    margin-bottom:50px;
    margin-left: 50px;
    margin-right: 50px;
    @bottom-right {
        content: element(footer);
        }
}
5
  • 1
    The @page CSS at-rule is used to modify some CSS properties when printing a document. You can't change all CSS properties with @page. You can only change the margins, orphans, widows, and page breaks of the document. Attempts to change any other CSS properties will be ignored. Jun 13, 2018 at 9:43
  • 1
    I already know this. My question is not about the capabilities of what '@page' can do in terms of properties. My question is about whether or not i can change things like margins on the 2nd print page specifically using '@page'. Jun 13, 2018 at 9:57
  • Im not sure if it works with @page (I think so) but you can try :nth-child(2) Jun 13, 2018 at 10:46
  • That was a good suggestion. Unfortunately it doesn't seem to work. Jun 14, 2018 at 9:47
  • did you find your answer to this? I am trying to modify the margins on my second page Mar 19, 2020 at 10:32

1 Answer 1

1

TL;DR: Use @page:first for the first page and keep using @page for the second page and beyond.

I could not find a solution for the 2nd page and on, :nth-child(2) or @page + @page did not work for me, but @page:first does work, so I ended up solving my problem with it. Hopefully it fits your needs as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.