gpt4 book ai didi

css - 使用 :first line selector? 的边框半径

转载 作者:行者123 更新时间:2023-12-02 08:40:31 25 4
gpt4 key购买 nike

我的 HTML 中有以下内容:

<p class="caption">Lorem Ipsum is a dummy text.It is used to display text in web page.</p>

在我的 CSS 中:

.caption:first-line
{
background-color:green;
border-radius:4px;
padding:5px 10px;
}

只有 background-color 被应用到第一行,其余的样式被省略。谁能帮忙?

最佳答案

那是因为 border-radiuspadding :first-line 选择器支持的属性.

以下引用摘自 MDN documentation :

Only a small subset of all CSS properties can be used inside a declaration block of a CSS ruleset containing a selector using the ::first-line pseudo-element:

all font-related properties: font, font-style, font-variant, font-weight, font-size, line-height and font-family.

The color property, all background-related properties: background-color, background-image, background-position, background-repeat, background-size, and background-attachment, word-spacing, letter-spacing, text-decoration, text-transform, and line-height.

关于css - 使用 :first line selector? 的边框半径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16892863/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com