Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does setting a :first-letter selector with whitespace cause mouse highlighting to be offset?

Having an issue where by adding whitespace I get the following highlighting offset weirdness. Is this really expected behaviour?

This seems to affect Chrome/Safari

Highlighting weirdness

Issue is reproduced here: https://jsfiddle.net/qsa99cc6/

CSS:

p:first-letter {
    text-transform: uppercase;
}

HTML:

<p>
         highlight me! this won't work because there's whitespace in the &lt;p&gt;
</p>

<p>highlight me! This should work because there isn't</p>
like image 444
Mark Avatar asked Nov 10 '22 03:11

Mark


1 Answers

It's behaviour is different on various browsers. So it could also be some sort of bug in the browser. Maybe those browsers identify the pseudo-element :first-letter the same way as the pseudo-elements :before and :after.

like image 72
Daan Avatar answered Nov 15 '22 07:11

Daan