CSS content Property
Example
a::after {
content: " (" attr(href) ")";
}
Meaning
The content property generates content in a document and is used with the :before and :after pseudo-elements.
This attribute replaces an element with a generated value. Objects inserted using the content property are anonymous replaced elements.
Default value: | normal |
Inherited: | No |
Animatable: | No |
Version: | CSS2 |
JavaScript syntax: |
|
Standard Syntax
content: normal|none|counter|attr|string|open-quote|close-quote|no-open-quote|no-close-quote|url|initial|inherit|revert|revert-layer|unset;
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Status
Property Values
The following table describes the values of this property.
Value | Description |
---|---|
normal | This is default value. It computes to none for the :before and :after pseudo-elements. |
none | The pseudo-element is not generated. |
counter() | This value specifies the content as a counter. See the counter-reset and counter-increment property for more information. |
string | Inserts the specified string (text content). |
url(url) | The value of url() designates an external resource (such as an image). If the resource or image can't be displayed, it is either ignored or some placeholder shows up. |
attr(attribute) | This function inserts the value of specified attribute before or after the selected element(s). If the subject of the selector does not have the specified attribute, an empty string will be inserted. |
open-quote | Insert the opening quotation mark. These values are replaced by the appropriate string from the quotes property. |
close-quote | Insert the closing quotation mark. These values are replaced by the appropriate string from the quotes property. |
no-open-quote | Do not display the opening quotation mark, but increments (decrements) the level of nesting for quotes. |
no-close-quote | Do not display the closing quotation mark, but increments (decrements) the level of nesting for quotes. |
initial | Sets this property to its default value. |
inherit | If specified, the associated element takes the computed value of its parent element animation-delay property. |
revert | Reverts the cascaded value of the property from its current value to the value the property |
revert-layer | Rollback styles to the ones specified in previous cascade layers. |
unset | Resets a property to its inherited value if the property naturally inherits from its parent, and to its initial value if not. |
Default CSS Property Values
selectors {
content: normal;
}