I’m using a custom highlight color on my site with the CSS ::selection rule, but noticed that in Webkit browsers the selection color doesn’t exactly work on everything.
Here’s a fiddle showing what I mean, using a numbered list as an example: http://jsfiddle.net/ufGmP/
If you highlight the text in Chrome or Safari, the default blue highlight color is seen around the bullets. I’ve noticed this issue on every site I’ve found using ::selection to override the default color; for instance, on http://www.smashingmagazine.com/ the default selection color can be seen if the entire headline of a story is highlighted.
Does anybody know a way around this? Any help would be much apprecaited!
It’s a bug that’s been hanging around from 2010, https://bugs.webkit.org/show_bug.cgi?id=38943.
A number of elements fail to highlight, here’s a fiddle, http://jsfiddle.net/AULsp.
HTML
CSS
WebKit also seems to highlight element padding and margin on the elements that do allow ::selection, which can look pretty off depending on your design.