In CSS3 paged media this is possible using position: running()
and content: element()
.
Example from the CSS Generated Content for Paged Media Module draft:
@top-center {
content: element(heading);
}
.runner {
position: running(heading);
}
.runner can be any element and heading
is an arbitrary name for the slot.
EDIT: to clarify, there is basically no browser support so this was mostly meant to be for future reference/in addition to the 'practical answers' given already.