https://shkspr.mobi/blog/2025/09/targetting-specific-characters-with-css-rules/ Terence Eden. He has a beard and is smiling. Terence Eden's Blog Mastodon. LinkedIn. GitHub. Email. Feed. Theme Switcher: ( ) Dark ( ) Light ( ) eInk ( ) xterm ( ) Drunk ( ) Nude ( )[?][?] Reset 2025-09-23 Targetting specific characters with CSS rules css HTML * 8 comments * 450 words * Viewed ~4,185 times --------------------------------------------------------------------- You can't. There is no way to use CSS to apply a style to every letter "E". It simply can't be done. At least, that's what they want you to think... What if I told you there was a secret and forbidden way to target specific characters in text and apply some styles to them? As part of my experiments in creating a "drunk" CSS theme, I thought it would be useful to change the presentation of specific characters. Wouldn't it be fun to have every letter "a" look slightly different to the rest of the text?! So here's how you can apply limited CSS styles to certain characters while leaving the rest of the text unchanged, and without having to wrap characters in extra markup. [css] CSS@font-face { font-family: "Different"; src: url("whatever.woff2") format("woff2"); /* Lower-Case Vowels */ unicode-range: U+61, U+65, U+69, U+6F, U+75 ; } body { font-family: "Different", sans; } This creates a new font-family called "Different". It loads a unique font. It is applied to specific Unicode characters - in this case: a, e, i , o, and u. The body places this font-family first and then defaults to a different family. This means all the lower-case vowels will use one font, and every other character will use something else. That's... OK. I guess? Having certain characters as Garamond and the others as Times New Roman isn't exactly exciting, is it? Sadly, there only other thing we can do in CSS to spice things up is to monkey around with size-adjust which lets the text be scaled up or down. But modern fonts are pretty magic, you know! The WOFF2 format has a new(ish) COLR table which allows you to create multi-coloured fonts. That means it is possible to target specific characters and have them display in living colour. For example, using this colourful pixel font by Patrick H. Lauke (CC BY), I can target the Unicode Range of upper-case characters. The above CSS only changes the appearance of UPPER Case characters! To wrap things up - yes, you can target specific characters with CSS rules. Sadly, you're pretty much limited to fiddling around with their fonts. --------------------------------------------------------------------- Share this post on... * Mastodon * Facebook * LinkedIn * BlueSky * Threads * Reddit * HackerNews * Lobsters * WhatsApp * Telegram 8 thoughts on "Targetting specific characters with CSS rules" 1. [bafkreie] [] James Aylett Congratulations, this is evil, no notes Reply | Reply to original comment on bsky.app 2025-09-23 12:54 2. [1cbc28d4] [] Owen Blacker Very cool! I use this technique to load only the Hebrew and Arabic fonts from some monospaced fonts for editing Wikipedia without forcing me to use those fonts' Latin characters, but I'd never thought to use it for something like the range of capital letters. (I also didn't know I could use size-adjust in those rules. I'm gonna have to experiment with that!) Reply 2025-09-23 12:56 3. [8a677be8] [] myf @Edent Historically, it was *very* (well, kinda) common to embellish ampersands this way. (Ironically, the "nice" ampersand was often pushed to fonts that had nearly identical ampersand to the one "borrowed" built-in, under some style-set. But it's a different story.) One remark: usually, it is not needed to make an extra font-family including the single face containing the tiny character subset: you can just subset the ranges in the **same** "main" family through a "ranged" face. Reply | Reply to original comment on typo.social 2025-09-23 13:46 4. [missing] [] Vincent Sparks @Edent i do love me some quality CSS crimes Reply | Reply to original comment on furry.engineer 2025-09-24 07:31 5. [9015f5c7] [] Girl-Man and the Boy Woman That's the coolest thing ever Reply | Reply to original comment on app.wafrn.net 2025-09-24 11:56 6. [c870e460] [] Gabbo the wafrn guy Thats so cursed. Quick nobody look at this no more CSS crimes in wafrn Reply | Reply to original comment on app.wafrn.net 2025-09-24 13:59 7. [] Tenno Seremel' @blog I used this once to get serif quotation marks in otherwise sans serif text [?] Reply | Reply to original comment on gts.skobk.in 2025-09-24 20:23 8. [a9d0ea78] [] laqs (l lvtvr) @Edent forgejo and codeberg do this for Korean, Japanese, and Chinese, because Google's Noto fonts only include one language at a time for whatever reason. Reply | Reply to original comment on tooot.im 2025-09-25 11:50 9. [svg] More comments on Mastodon. What are your reckons? Cancel reply All comments are moderated and may not be published immediately. Your email address will not be published. [ ] [ ] [ ] [ ] [ ] [ ] [ ] Comment: [ ] [ ] See allowed HTML elements:




 Your Name (required): [                              ] Your
Email (required): [                    ] Your Website (optional):
[                    ]

[Post Comment]   

   To respond on your own website, write a post which contains a link
to this post - then enter the URl of your page here. Learn more about
WebMentions. 

   URl of your article   [                    ]  

   [Ping me!]  

 Search

Search for: [                    ] [Search]
[?] Explore The Archives

  * 2025
      + January  17 posts  February  20 posts  March  23 posts  April
          22 posts  May  16 posts  June  28 posts  July  24 posts 
        August  20 posts  September  13 posts 

        October  

        November  

        December  

  * 2024
      + January  31 posts  February  29 posts  March  31 posts  April
          30 posts  May  31 posts  June  30 posts  July  19 posts 
        August  18 posts  September  18 posts  October  29 posts 
        November  31 posts  December  30 posts 
  * 2023
      + January  31 posts  February  28 posts  March  31 posts  April
          30 posts  May  31 posts  June  30 posts  July  31 posts 
        August  31 posts  September  30 posts  October  31 posts 
        November  30 posts  December  31 posts 
  * 2022
      + January  30 posts  February  23 posts  March  15 posts  April
          19 posts  May  19 posts  June  19 posts  July  19 posts 
        August  18 posts  September  12 posts  October  8 posts 
        November  30 posts  December  31 posts 
  * 2021
      + January  31 posts  February  28 posts  March  31 posts  April
          30 posts  May  31 posts  June  30 posts  July  31 posts 
        August  31 posts  September  30 posts  October  31 posts 
        November  30 posts  December  31 posts 
  * 2020
      + January  31 posts  February  29 posts  March  31 posts  April
          30 posts  May  31 posts  June  30 posts  July  31 posts 
        August  31 posts  September  30 posts  October  31 posts 
        November  30 posts  December  31 posts 
  * 2019
      + January  31 posts  February  12 posts  March  17 posts  April
          12 posts  May  12 posts  June  10 posts  July  7 posts 
        August  5 posts  September  6 posts  October  14 posts 
        November  30 posts  December  17 posts 
  * 2018
      + January  8 posts  February  4 posts  March  6 posts  April 
         14 posts  May  5 posts  June  6 posts  July  6 posts  August
          13 posts  September  14 posts  October  8 posts  November 
         30 posts  December  4 posts 
  * 2017
      + January  12 posts  February  9 posts  March  8 posts  April 
         4 posts  May  10 posts  June  5 posts  July  5 posts  August
          6 posts  September  3 posts  October  4 posts  November  30
        posts 

        December  

  * 2016
      + January  10 posts  February  10 posts  March  11 posts  April
          9 posts  May  8 posts  June  9 posts  July  6 posts  August
          9 posts  September  4 posts  October  2 posts  November  30
        posts  December  14 posts 
  * 2015
      + January  8 posts  February  11 posts  March  10 posts  April 
         4 posts  May  9 posts  June  3 posts  July  7 posts  August 
         9 posts  September  10 posts  October  2 posts  November  30
        posts  December  4 posts 
  * 2014
      + January  13 posts  February  13 posts  March  15 posts  April
          14 posts  May  8 posts  June  7 posts  July  9 posts 
        August  5 posts  September  5 posts  October  1 post 
        November  30 posts  December  20 posts 
  * 2013
      + January  25 posts  February  17 posts  March  15 posts  April
          18 posts  May  11 posts  June  14 posts  July  6 posts 
        August  14 posts  September  6 posts  October  4 posts 
        November  30 posts  December  15 posts 
  * 2012
      + January  14 posts  February  8 posts  March  13 posts  April 
         15 posts  May  10 posts  June  16 posts  July  8 posts 
        August  8 posts  September  6 posts  October  6 posts 
        November  30 posts  December  30 posts 
  * 2011
      + January  13 posts  February  11 posts  March  12 posts  April
          12 posts  May  8 posts  June  8 posts  July  6 posts 
        August  5 posts  September  11 posts  October  7 posts 
        November  30 posts  December  17 posts 
  * 2010
      + January  6 posts  February  15 posts  March  12 posts  April 
         13 posts  May  4 posts  June  3 posts  July  15 posts 
        August  8 posts  September  11 posts  October  10 posts 
        November  30 posts  December  9 posts 
  * 2009
      + January  1 post  February  5 posts  March  3 posts  April  7
        posts  May  12 posts  June  8 posts  July  10 posts  August 
         10 posts  September  12 posts  October  22 posts  November 
         31 posts  December  15 posts 
  * 2008
      + January  2 posts 

        February  

        March  2 posts  April  3 posts  May  2 posts 

        June  

        July  1 post  August  3 posts  September  1 post  October  3
        posts  November  2 posts  December  1 post 
  * 2007
      + January  

        February  

        March  

        April  

        May  

        June  

        July  

        August  

        September  

        October  

        November  4 posts  December  5 posts 
  * 2006
      + January  

        February  

        March  

        April  1 post 

        May  

        June  

        July  

        August  

        September  

        October  

        November  1 post 

        December  

  * 2005
      + January  

        February  

        March  1 post 

        April  

        May  

        June  

        July  

        August  

        September  1 post 

        October  

        November  

        December  

  * 2004
      + January  1 post 

        February  

        March  

        April  

        May  5 posts  June  3 posts  July  1 post 

        August  

        September  

        October  

        November  

        December  

  * 2003
      + January  

        February  

        March  2 posts 

        April  

        May  

        June  

        July  

        August  

        September  

        October  

        November  

        December  

  * 2002
      + January  

        February  1 post 

        March  

        April  3 posts 

        May  

        June  

        July  

        August  

        September  

        October  

        November  

        December  

  * 2001
      + January  

        February  

        March  

        April  

        May  

        June  

        July  1 post 

        August  

        September  

        October  1 post 

        November  

        December  

  * 2000
      + January  

        February  

        March  1 post 

        April  

        May  

        June  

        July  

        August  

        September  

        October  1 post  November  1 post 

        December  

  * 1999
      + January  

        February  

        March  

        April  

        May  

        June  

        July  

        August  

        September  1 post 

        October  

        November  

        December  1 post 
  * 1998
      + January  

        February  

        March  

        April  

        May  1 post 

        June  

        July  

        August  

        September  

        October  

        November  

        December  

  * 1997
      + January  1 post 

        February  

        March  

        April  

        May  

        June  

        July  

        August  

        September  

        October  

        November  

        December  

  * 1995
      + January  

        February  

        March  1 post 

        April  

        May  1 post 

        June  

        July  

        August  

        September  

        October  

        November  

        December  

  * 1994
      + January  

        February  

        March  

        April  1 post 

        May  

        June  

        July  

        August  

        September  

        October  

        November  

        December  

  * 1993
      + January  

        February  

        March  

        April  

        May  

        June  1 post 

        July  

        August  

        September  

        October  

        November  

        December  

  * 1987
      + January  

        February  

        March  

        April  

        May  

        June  

        July  

        August  

        September  

        October  

        November  

        December  1 post 

Subscribe by Email

[                                        ] [                    ]
[Subscribe]
  * (c) Terence Eden
  * Support My Blog
  * About Me
  * Contact Me
  * Open Source Contributions
  * Subscribe
  * Citations
  * Library
  * On This Day
  * Trending Posts
  * Random Post
  * Link Rot

ISSN 2753-1570 MMXXV

c Terence Eden

*