English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Complete CSS Selector Reference Manual
The style selected for the first letter of each <p> element:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Basic Tutorial(oldtoolbag.com)</title>/title> <style> p:first-letter { font-size:200%; color:#0000ff; } </style> </head> <body> <h1>Welcome to My Homepage</h/h1> <p>My name is Jack.</p>/p> <p>I live in Shanghai.</p>/p> <p>My best friend is Linda.</p>/p> </body> </html>Test and see ‹/›
:first-The letter selector is used to specify the style of the first letter of an element.
Hint: :first-The letter selector can use the following properties:
font properties
color properties
background properties
margin properties
padding properties
border properties
text-decoration
vertical-align (only if float is 'none')
text-transform
line-height
float
clear
Note: "first-letter" Selector is only applicable to block-level elements.
The numbers in the table indicate the first browser version number that supports the attribute.
Selector | |||||
---|---|---|---|---|---|
::first-letter | 1.0 | 9.0 Part from5.5 | 1.0 | 1.0 | 7.0 Part from5.5 |
Note: IE 5.5-8 and Opera 4-6 Only supports the old syntax standard, single-colon CSS2Syntax (:first-letter). New versions support the standard, double colon CSS3Syntax (::letter).
CSS Tutorial: CSS Pseudo-elements