Copying Text Content
James Paden avatar
Written by James Paden
Updated over a week ago

Copying Text Content

Named strings let you copy text from an element and reuse it. This CSS behavior is part of the CSS Generated Content for Paged Media Module specifications, which are still a draft but helpfully supported by DocRaptor and Prince.

Copying content is most useful when you want to replicate something in your documents, such as inserting a chapter or section title into a header or footer.

The string-set property takes a name and a content definition, such as content() or attr(attribute-name). The content can be inserted via the content property and the string() function. For example:

h1 {
string-set: chapter content();
}

@page {
@top {
content: string(chapter);
}
}
Did this answer your question?