I want to use the value generated by counter(pages)
in order to do something specific on the last page of a printed web document using an @page
rule.
Using counter(pages)
is working fine for me in an at-page context:
@page {
@top-right {
content: counter(pages);
}
}
Addressing a specific page also works fine:
@page: nth(69) {
@top-right {
content: normal;
}
}
What I want is to pass the total page count to nth()
, like so:
@page: nth(#{counter(pages)}) {
@top-right {
content: normal;
}
}
Without success.
I've tried using a SASS variable:
$pagecount: 69; // this works
$pagecount: '69'; // even this works
$pagecount: #{counter(pages)}; // but this doesn't
$pagecount: counter(pages); // nor does this
...
@page: nth(#{$pagecount}) {...}
...
When I try to use the dynamic value my code always compiles to
@page :nth(counter(pages)) {}
which of course does nothing.
Is it possible to get the total page count into nth()
?