:first-letter 选择器用于选取指定选择器的首字母。
注释:以下属性可与 :first-letter 使用:
选择每个 <p> 元素的首字母,并为其设置样式:
<!DOCTYPE html>
<html>
<head>
<style>
p:first-letter
{
font-size:200%;
color:#8A2BE2;
}
</style>
</head>
<body>
<h1>Welcome to My Homepage</h1>
<p>My name is Donald.</p>
<p>I live in Duckburg.</p>
<p>My best friend is Mickey.</p>
</body>
</html>
<view>huang ju hua</view>
<view>黄菊华老师</view>
<text>huang ju hua</text>
<view>
<text>huang ju hua</text>
</view>
view::first-letter{
color: red;
font-size: x-large;
}
text::first-letter
{
color: red;
}