1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

How to localize content property in margin at-rules of paged media?

Discussão em 'Angular' iniciado por Tom S, Junho 26, 2025.

  1. Tom S

    Tom S Guest

    I'm generating PDFs from a webpage using print styles and want to include localized page numbering (e.g., "Page 1 of 5" in English, "Side 1 av 5" in Norwegian) in the bottom-right margin of each page.

    This CSS works fine for a single language:

    @page {
    @bottom-right {
    content: 'Page ' counter(page) ' of ' counter(pages);
    }
    }


    However, I want to reflect the user's current locale. I tried using the :lang() pseudo-class like this:

    html:lang(nb) {
    @page {
    @bottom-right {
    content: 'Side ' counter(page) ' av ' counter(pages);
    }
    }
    }

    html:lang(en) {
    @page {
    @bottom-right {
    content: 'Page ' counter(page) ' of ' counter(pages);
    }
    }
    }


    But this does not work. Nothing shows up in the margin.

    Is it possible to localize @page margin at-rules based on the document language?

    Continue reading...

Compartilhe esta Página