Ich habe den folgenden Code:Warum funktioniert :: first-line nicht für Span wie p/div Tags?
p::first-line {
color: #ff0000;
font-variant: small-caps;
}
span::first-line {
color: #ff0000;
font-variant: small-caps;
}
<span> This is to check span.This is to check spanThis is to check spanThis is to check spanThis is to check spanThis is to check spanThis is to check spanThis is to check spanThis is to check spanThis is to check span</span>
<p>This is to check p.This is to check p.This is to check p.This is to check p.This is to check p.This is to check p.This is to check p.This is to check p.This is to check p.This is to check p.This is to check p.This is to check p.This is to check p.</p>
Problem ist, dass das Pseudoelement arbeitet für p
Tag und veränderte erste Zeile angegeben Farbe, aber die gleiche Arbeit ist nicht für span
Tag.
:: first-line funktioniert nicht mit 'display: flex' entweder. Um das zu beheben, empfehle ich, den Text in ein 'paragraph'- oder' div'-Tag zu schreiben. – kunambi