我放弃.为什么:第一封信不在这里工作?
strong {
font-weight: bold;
color: blue;
}
strong:first-letter {
color: red;
}
<strong>test test</strong>
Run Code Online (Sandbox Code Playgroud)
除了其他答案之外,它(至少在Chromium中)也可以使用元素display: inline-block,因此display只需要除了inline(包括list-item)以外的任何东西,例如:
strong {
font-weight: bold;
color: blue;
display: inline-block;
}
strong::first-letter {
color: red;
}
Run Code Online (Sandbox Code Playgroud)
此外,::first-letter是一个伪元素,因此语法应该是双冒号而不是单个,以区分选择器和伪类.