Defines generated content that appears after an element.
Syntax
HTML | :after { sRules } |
---|
Scripting | N/A |
---|
Possible Values
sRules | String that specifies one or more Cascading Style Sheets (CSS) attribute/value pairs. |
Remarks
The :before and :after pseudo-elements specify the location of content before and after an element in the document tree. The content attribute, in conjunction with these pseudo-elements, specifies what is inserted.
The generated content interacts with other boxes as if they were real elements inserted just inside their associated element. The content box of the associated element expands to include the generated content, if necessary.
This pseudo-class requires that Internet Explorer be in IE8 mode rendering. For more information, see Defining Document Compatibility.
Example
The following style rules insert curly braces before and after each occurence of H1 in the document tree.
H1:before {
content: "{ ";
}
H1:after {
content: " }";
}
Standards Information
This pseudo-class is defined in
CSS, Level 2 Revision 1 (CSS2.1) .
Applies To
|
A,
ADDRESS,
B,
BIG,
BLOCKQUOTE,
BODY,
BR,
BUTTON,
CAPTION,
CITE,
CODE,
DD,
DFN,
DIV,
DL,
DT,
EM,
hn,
I,
IMG,
INPUT type=file,
INPUT type=image,
INPUT type=password,
INPUT type=text,
KBD,
LABEL,
LEGEND,
LI,
LISTING,
MARQUEE,
MENU,
NOBR,
OL,
P,
PLAINTEXT,
PRE,
S,
SAMP,
SMALL,
SPAN,
STRIKE,
STRONG,
SUB,
SUP,
TABLE,
TBODY,
TD,
TEXTAREA,
TFOOT,
TH,
THEAD,
TR,
TT,
U,
UL |
See Also
content