::first-letter CSS pseudo-element selector
CSS pseudo-element that allows styling only the first "letter" of text within an element. Useful for implementing initial caps or drop caps styling.
IE | Edge | Firefox | Chrome | Safari | Opera | iOS Safari | Opera Mini | Android Browser | Blackberry Browser | Opera Mobile | Chrome for Android | Firefox for Android | IE Mobile | UC Browser for Android | Samsung Internet | QQ Browser | Baidu Browser |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
49 | |||||||||||||||||
56 | 9.3 | 4.4 | |||||||||||||||
14 | 52 | 57 | 10 | 10.0-10.2 | 4.4.3-4.4.4 | 4 | |||||||||||
11 | 15 | 53 | 58 | 10.1 | 44 | 10.3 | all | 56 | 10 | 37 | 57 | 52 | 11 | 11.4 | 5 | 1.2 | 7.12 |
54 | 59 | TP | 45 | ||||||||||||||
55 | 60 | 46 | |||||||||||||||
56 | 61 |
Notes
The spec says that both letters of digraphs which are always capitalized together (such as "IJ" in Dutch) should be matched by ::first-letter, but no browser has ever implemented this.
-
1
Excludes punctuation immediately after the first letter from the match. (The spec says it should be included in the match.)
-
2
Acts like the first character is always a letter even when it's not. For example, given "!,X;", "!," is matched instead of the entire string.
-
3
Only recognizes the deprecated :first-letter pseudo-class, not the ::first-letter pseudo-element.
-
4
Only matches the very first character. The spec says that surrounding punctuation should also match.