:: before和:: first-line无法正常工作

问题描述 投票:0回答:1

MDN说:

::: first-line CSS伪元素将样式应用于块级元素的第一行。

但是当我写这篇文章时:

p::before {content: 'Red text'; display: block;}
p::first-line {color: red;}
<p>This text shouldn't be red</p>

它在Firefox中不起作用(单词“ Hello”不是红色)。这是怎么了?

css css-selectors pseudo-element
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.