Was this page helpful?
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

2.2.12 [CSS-Level2-2009] Section 5.12.2, The :first-letter pseudo-element

C0003:

The specification states:

 If an element is a list item ('display: list-item'), the ':first-letter' applies to 
 the first letter in the principal box after the marker. UAs may ignore ':first-
 letter' on list items with 'list-style-position: inside'. If an element has 
 ':before' or ':after' content, the ':first-letter applies to the first letter of 
 the element including that content. 
 E.g., after the rule 'p:before {content: "Note: "}', the selector 'p:first-letter' 
 matches the "N" of "Note".

All Document Modes (All Versions)

The :first-letter pseudo-class is not ignored on list items with list-style-position:inside.

C0004:

The specification states:

 If the letters that would form the first-letter are not in the same element, such 
 as "'T" in <p>'<em>T..., the UA may create a first-letter pseudo-element from one 
 of the elements, both elements, or simply not create a pseudo-element.

Quirks Mode and IE7 Mode (All Versions)

The :first-letter pseudo-element is created from the first two elements. The following example results in "T", where the first quotation mark and the T are green:

                 <style type="text/css">

            div:first-letter

            {

                color: green;

            }

        </style>

    </head>

    <body>

           <div>"<em>T</em>"</div>

    </body>

IE8 Mode and IE9 Mode (All Versions)

The :first-letter pseudo-element is created only from the first element. The following example results in "T", where only the first quotation mark is green:

                 <style type="text/css">

            div:first-letter

            {

                color: green;

            }

        </style>

    </head>

    <body>

           <div>"<em>T</em>"</div>

    </body> 

C0005:

The specification states:

 Similarly, if the first letter(s) of the block are not at the start of the line 
 (for example due to bidirectional reordering), then the UA need not create the 
 pseudo-element(s).

All Document Modes (All Versions)

The :first-letter pseudo-element is created for right-to-left (RTL).

Show:
© 2016 Microsoft