content
Important |
|---|
|
This documentation is preliminary and is subject to change. |
Sets generated content to insert before or after an element.
Syntax
{ content:
sContent
}
Possible values
sContent
String that specifies a space-delimited list, including one or more of the following values:
|
string |
Text content, in either double quotation marks (") or single quotation marks ('). |
|
counter(sCounter |
sCounterA counter identifier, optionally followed by listStyle. listStyleOptional. Any of the range of values from the list-style-type property. |
This property has no default value. It is not inherited.
Remarks
The content attribute is used in conjunction with :before and :after pseudo-classes to generate content in a document.
Strings can written with either double quotation marks (") or with single quotation marks ('). Double quotation marks cannot occur inside other double quotation marks, unless they are preceded by a backslash (\) escape character. For example, the string "\"" is interpreted as containing one double quotation character.
Examples
The following example generates braces before and after all the h1 elements on a page.
<html xmlns="http://www.w3.org/1999/xhtml">
<style type="text/css">
h1:before {
content: "{ ";
}
h1:after {
content: " }";
}
</style>
Standards information
This pseudo-class is defined in Cascading Style Sheets (CSS), Level 2, Revision 1 (CSS2.1)
.
Applies to
a, abbr, acronym, b, bdo, big, blockquote, body, button, caption, center, cite, code, custom, dd, defaults, del, dfn, div, dl, dt, em, embed, fieldset, font, form, frame, hn, i, img, input type=button, input type=checkbox, input type=file, input type=image, input type=password, input type=radio, input type=reset, input type=submit, input type=text, ins, li, object, ol, p, q, s, span, sub, table, td, th, tt, u, ul, var, xmp
Important