::before
Defines generated content that appears before an element.
Syntax
::before {
sRules }
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.
Examples
The following style rules insert curly braces before and after each occurrence of H1 in the document tree.
H1:before {
content: "{ ";
}
H1:after {
content: " }";
}
Standards Information
This pseudo-class is defined in CSS Selectors Level 3 .
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, 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
Concepts
::after
::selection
::first-letter
::first-line
Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.