To separate a lengthy string, I followed the approach outlined in this post:
.line {
display: inline-block;
}
<p>
<span class="line">This text should break</span>
<span class="line">after the word "break"</span>
</p>
However, if a line break is introduced, I aim to capitalize the initial letter of the second line. For instance, when there is no line break:
This text should break after the word "break"
If a line break does occur, the desired output would be:
This text should break
After the word "break"
I experimented with various approaches, but unfortunately, none of them yielded the intended result:
.line:not(::first-line)::first-letter {
text-transform: uppercase;
}
.line::first-letter {
text-transform: uppercase;
}
.line::first-line {
text-transform: none !important;
}
.line::first-letter {
text-transform: uppercase;
}
.line::first-line::first-character {
text-transform: none !important;
}
Is achieving this effect without JavaScript feasible?