View Single Post
Old 07-31-2022, 06:16 PM   #13
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,297
Karma: 12126329
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by Jellby View Post
Personally, I prefer <span class="first-letter"> instead of a pseudo-element. First, pseudo-elements are (were?) not widely supported.


Quote:
Originally Posted by Jellby View Post
Second, I want more control over what is the first letter, I may want to include (or not) an opening quote mark, or a following punctuation, [...]


Yep. This is the biggest reason why I don't use it. There's also too many edge-cases like:
  • poetry in very first line
  • AuthorBio as "first paragraph"
  • Image/Chart/Caption at beginning of chapter
  • Frontmatter/Backmatter
  • [...]

so using these pseudo-selectors won't be able to catch nuanced situations.

Again, if you KISS (Keep It Simple, Stupid) + use basic CSS and <span>:

Code:
<h2>Chapter 1</h2>

<p class="noindent"><span class="dropcap">“I</span> am testing dropcaps.</p>
... it's uglier code, but those will "work" everywhere and not break. :P

Quote:
Originally Posted by Hitch View Post
Yeah, I have to admit--this is how we roll, too. plain old span class first letter. I don't count on devices or firmware, etc. to support pseudos. It's just...you know.


You also have line-spacing problems + all the other issues that come with dropcaps/raised-caps.

Side Note: If you want more info on dropcaps, type this in your favorite search engine:

Code:
dropcaps Tex2002ans site:mobileread.com
dropcaps Hitch site:mobileread.com
we have over 8 years of discussion on the topic.

Hint: Trying to replicate dropcaps in ebooks is a very poor idea. To get them working across readers in all sorts of fonts + font sizes... it just won't be happening.

Quote:
Originally Posted by DaveLessnau View Post
What's interesting about ::first-letter is that, so far, it's been smart enough to work correctly with starting punctuation (i.e., quotes and ellipsis, that I've noticed).
Which readers did you test on?

Like Jellby said, I've definitely seen it break when dealing with punctuation.

Quote:
Originally Posted by JSWolf View Post
I've seen plenty of cases where the first character in the first paragraph was a quote and it was made lager along with the first letter. If :first-letter does not work that way, then it's not the correct way to do it.
You can read about it at:

As always, it's a hell of a lot more complicated when taking into account Internationalization too (for example, MDN mentions "IJ" is considered a single "letter" in Dutch).

Last edited by Tex2002ans; 07-31-2022 at 06:19 PM.
Tex2002ans is offline   Reply With Quote