简体   繁体   中英

Is there a way to target all the instances of a specific character using CSS?

I have a client who wants to use a script font (Better Personality Script) for dropcaps. This is problematic, because ten of the font's uppercase letters are different widths, and are positioned differently on their baselines than the rest of the font.

I would like to be able to write CSS that provides specific rules for when each of those ten uppercase letters appears within the .drop-cap class. Is this possible?

There is no way to target uppercase characters to style them differently unless each is wrapped in its own element (a span would work well for that). Of course, that's going to be a very manual process.

You can applytext-transform to your .drop-cap class but you would only be changing the visual to not show uppercase letters. You can't actually style uppercase letters differently.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM