sourjayne.comblog → Nerd request: PHP + CSS + Typography

Nerd request: PHP + CSS + Typography

June 14th, 2010 3 notes

I’m in the process of designing a custom theme for this blog and my personal site, and I have a really weird crazy idea related to making some fun, fancy, decorative initial caps styles for my blog posts.

The kicker is, I don’t think I want to replace the actual first letter of the paragraph with my decorative initial letter, I just want to kinda repeat it, graphically. Why? Because the way I want to treat them would just be for visual interest, and it would be pretty hard to read if I didn’t repeat the first letter in normal text. Does that even count as an initial cap?

So I wouldn’t be able to simply use the CSS first-letter pseudo element. To do this, I think I’d need to have a php (or something) script extract the first letter of the post so I could repeat it, then treat the extra letter graphically through CSS. Is this technically possible, or am I crazy?

  1. guillee answered: Perfectly possible. Off the top of my head, something like $letter = substr(strip_tags($post_body), 0, 1); (Disclaimer: My PHP is rusty.)
  2. sourjayne-ux posted this

photo of Sarah A blog full of thoughts and observations on making the web a better place, collected by Sarah Harrison.