Name

content

Values:

normal | [ <string> | <uri> | <counter> | attr(<identifier>)| open-quote | close-quote | no-open-quote | no-close-quote ]+ | inherit

Initial value:

normal

Applies to:

:before and :after pseudo-elements.

Inherited:

No.

Computed value:

For <uri> values, an absolute URI; for attribute references, the resulting string; otherwise, as specified.

Description:

This is the property used to define the generated content placed before or after an element. By default, this is likely to be inline content, but the type of box the content creates can be controlled using the property display.

Examples:

p:before {content: "Paragraph...";}
img:after {content: attr(src);}
a[href]:after {content: "(" attr(href) ")"; font-size: smaller;}

Supported by:

Firefox, Opera, Safari.

Get CSS Pocket Reference, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.