Quote:
Originally Posted by Jellby
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
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
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
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
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).