Forum How do I...?

How do I select the last element on a page?

marimbus
I'm trying to eliminate padding on the last element of a page.
(@page > :last-child) doesn't seem to be working. Is there a way to do this?
mikeday
At the moment there is no method for selecting an element based on where it appears on the page.
sebastian
Hi,
since this question is more than 4 years old I would like to know if it is still not possible to select the last element on a page or achieve what was asked in another way?
mikeday
No, not yet. It might be possible with the JavaScript box tracking API we are developing for the next release of Prince. It's always going to be a tricky feature to have though, as it introduces a circular dependency, where the style you use for an element depends upon its position, and its position depends upon its style.
jim_albright
Sometimes I find that it is better to describe the problem that you are having rather than the solution you desire. Perhaps there is a solution if we know what the true problem is.

Jim Albright
Wycliffe Bible Translators

dauwhe
Any CSS problem can be solved either by changing padding to margin (or vice versa), or by declaring something to be an inline block ;)

Dave
mikeday
Too true! :D