content: normal | flow( name, page-policy? ) | [ "string" | url( filename ) | counter( name, counter-style?, page-policy? ) | counters( name, "separator", counter-style?, page-policy? ) | target-counter( url, counter, counter-style? ) | target-counters( url, counter, "separator", counter-style? ) | target-content( url ) | leader( "..." | dotted | solid | space ) | string( ident, page-policy? ) | content( ) | prince-base-url( ) | prince-script( ident, content? ) | prince-glyph-index( number ) | prince-fallback( url ) [ , content+ ]? | element( name ) ]+
|Applies to||all elements, tree-abiding pseudo-elements, and page regions|
content property can be used to insert text and other content
into the original document. The uses are vary wide-ranging and are treated in
more depth in the Generated Content
The most simple use is to insert a literal string. A literal string can also
be passed as an argument to the
leader() function, which expands
to fill the available space on the line like justified text, by repeating the
string as many times as necessary. It can also be referenced with the
string() function, in which case it needs to be defined in the
property (see Copying
text content from the document).
The second argument to the
string() function is a
page-policy, which can be one of the following:
(the first value the string is set to on the page),
start unless the
is applied on the current page, in which case it will return no value),
last (the last value the string is set to on the page) or
start (the value the string has at the start of the page).
These page policy values are only meaningful for
string() used in page region content.
It can also be used to insert external content fetched from another resource:
this can be done with the
url() function, the
function (see Using target-content)
prince-base-url() function. It can also be done
prince-fallback() function, which works just like the
url() function, but also has the possibility of specifying a fallback
content, in case the loading of the URL should fail.
The content to be inserted can also be fetched from other elements, or their
attributes, with the
element() and the
or with the
content() function. Also, any block-level element can
be removed from the normal flow with the
property and can be inserted with the
flow() function. See also the
documentation for Taking
elements from the document for more details.
content property can also be used for different forms of counters
(see Using target-counter)
from CSS generated content using the
prince-script() function (see
A special function is
prince-glyph-index, which allows to choose
a glyph from a font by the index of that glyph in the font. Note that this is
very non-portable, as glyph indices are specific to individual font versions.
But it is a possible escape hatch for people who need a specific glyph and don't
have any other way of accessing it (by Unicode character or OpenType substitution).