Open 5e-Cleric opened 1 year ago
I have so far been unable to develop a CSS selector to target the first letter only when it is styled. However I suspect the easiest solution is to instead simply remove any such styling from the drop cap, so it is never italicized.
you can't style based on applied styles, unless they are set in inline styles:
.page .element[style*="color:red;"] {}
should work fine.
But that does not work for the ::first-letter
pseudo-selector.
A solution would be to fix this for manual cursive, but not for programatic one:
# This is a test
*T*his test will try to find a solution for the drop cap clip when you use cursive.
This one outputs an em
element inside the P, and can be styled easily. And somehow counts the T as first-letter, so it can be styled with .page h1+p:has(em)::first-letter
.
I was attempting to use something like .page h1+p:has(em:first-child)::first-letter
to target only first letters that were italicized, but it seems that the text elements inside a p
don't count as children, so ANY p
that contained an em
was targeted.
Is it easier to create a distinct font variant of that drop cap font, italic? Then could bake in better spacing. Rather than relying on browser to fake the italic.
I suspect that the easiest solution is simply to remove the italicization, with the primary justification that no drop cap in any official source book is italicized, and secondary justifications that the kerning between two different fonts is difficult to manage, even more so with additional text styling.
K. I also agree that italicizing the drop cap makes no sense. I don’t think we need to do anything here— just tell users not to include it in the italic syntax.
I could give a try to making an italicized version, but i agree there is no point in having that option.
If we are going to enforce the no-italics rule, we might as well force caps too, text-transform:uppercase
is a great piece of code.
I don’t think we should enforce anything. It’s easy enough to just not include the letter in the italics. If we have weird hidden rules it’s only going to confuse people who want to do something a little different, with different fonts or whatever.
As reported on reddit, the clip box of the drop cap letter does not change based on text variants or styles.
This means that setting the text as cursive makes the letter clip behind text: