I'm trying to style a drop-cap using the :first-letter
pseudo selector, but Firefox is ignoring line-height
:
p {
font-family: sans-serif;
line-height: 3rem;
font-size: 2.4rem;
}
p:first-letter {
float: left;
background-color: black;
color: white;
line-height: 6rem;
font-size: 4.8rem;
padding: 0 1rem;
margin-right: 0.5rem;
}
<p>Feugiat adipisci salutandi mei eu, eu vix purto vero oratio. Eam justo viris
iudicabit te, sea dico esse tritani ea. Sed ad epicurei splendide. Ut constituam
delicatissimi usu. Et pro quem ceteros, ad cum doming eripuit reformidans.
Suspendisse pulvinar congue elit, vitae tincidunt mauris tempus non. Morbi
mattis tellus orci, sit amet tincidunt nibh ullamcorper vitae. Phasellus
suscipit augue nec diam elementum, at porta est egestas.</p>
It appears to be an ancient bug / feature. See here.
Is there a workaround?
I cannot modify the markup at all, so no wrapping the first letter in another element to allow targeting it without first-letter
.
I can't use vertical padding as Firefox collapses to a different line-height
than other browsers, even at a line-height
of zero, meaning I would have to target FF with different vertical padding values.
Setting display
explicitly to block
, inline-block
or flex
has no effect.
Setting height
or min-height
has no effect.
I am aware of inital-letter
but the support is a long way from enough.