Border Radius使用:第一行选择器?

Nid*_*ida 2 css css-selectors css3

我的HTML中有以下内容:

<p class="caption">Lorem Ipsum is a dummy text.It is used to display text in web page.</p>
Run Code Online (Sandbox Code Playgroud)

在我的CSS中:

.caption:first-line
{ 
background-color:green;
border-radius:4px;
padding:5px 10px;
}
Run Code Online (Sandbox Code Playgroud)

background-color应用于第一行,并省略其余样式.有人可以帮忙吗?

dsg*_*fin 5

这是因为border-radiuspadding支持的特性:first-line选择.

以下引用来自MDN文档:

在包含使用::first-line伪元素的选择器的CSS规则集的声明块中,只能使用所有CSS属性的一小部分 :

所有字体相关的属性:font,font-style,font-variant, font-weight,font-size,line-heightfont-family.

color物业,所有background产权相关属性:background-color,background-image, background-position,background-repeat,background-size,和 background-attachment,word-spacing,letter-spacing,text-decoration, text-transform,和line-height.