看看
specs:
在包含使用:: first-letter伪元素的选择器的CSS规则集的声明块中,只能使用所有CSS属性的一小部分:
>所有字体属性:font,font-style,font-feature-settings,font-kerning,font-language-override,font-stretch,font-synthesis,font-variant,font-variant-alternates,font-variant-caps,font-variant-east-asian,font-variant-ligatures,font-variant-numeric,font-variant-position,font-weight,font-size,font-size-adjust,line-height和font-family.
>所有背景属性:背景颜色,背景图像,背景剪辑,背景原点,背景位置,背景重复,背景大小,背景附件和背景混合模式.
>所有保证金属性:保证金,保证金顶部,保证金权利,保证金底部,保证金左边.
>所有填充属性:填充,填充顶部,填充右侧,填充底部,填充左侧.
>所有边框属性:短边框边框,边框样式,边框颜色,边框宽度,border-radius,border-image和longhands属性.
>颜色属性
>文字装饰,文字阴影,文字转换,字母间距,
字间距(适当时),行高,文字装饰色,
text-decoration-line,text-decoration-style,box-shadow,float,
vertical-align(仅当float为none时)CSS属性.
由于此列表将来会进行扩展,因此建议您不要在声明块中使用任何其他属性,以保持CSS面向未来.
现在为您的问题,如果您可以更改您的html结构,您可以使用跨度为第一个字母,并根据您的喜好设置样式.例如:
.some-word span {
font-size: 50px;
position: relative;
padding-right: 10px;
}
Product