www.fgks.org   »   [go: up one dir, main page]

:before Pseudo-class
New for Windows Internet Explorer 8
Note: This documentation is preliminary and is subject to change.

Defines generated content that appears before an element.

Syntax

HTML:before { sRules }
ScriptingN/A

Possible Values

sRulesString 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) World Wide Web link.

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


MSDN Library
Web Development
HTML and CSS
Cascading Style Sheets (CSS)
CSS Reference
Selectors
Pseudo-classes
:before
Tags: 
 
Community Content