1

By text highlighting, I am referring to highlighting text on a website with the mouse, and it displays white text and blue highlight.

Well, I was trying to change it, and it works perfectly on all other browsers, but Chrome makes the highlight too dark.

How can I fix this? Thank you, and my apologies for the idiotic question.

Edit: I know it's possible, because this site managed to do it. http://www.codeitpretty.com/

This is how it looks on Chrome

This is how it looks on Firefox and others

::-moz-selection { 
    background-color: #694489; 
    color: #000;
}

::selection {
    background-color: #694489; 
    color: #000;
}

::-webkit-selection {
    background-color: #694489; 
    color: #000;
}
  • You can't target Chrome specifically using CSS, unfortunately. The closest I've seen people get is Chrome and Safari/Opera, but even that it's hacky as hell. I'd recommend mixing a bit of JavaScript into that. – Adrian Dec 30 '17 at 02:47
  • 1
    Could you show a screenshot of Chrome vs browser that works well? When recreating this it does as intended. Also, just to make sure you want `#000` (black) text, not `#fff` (white) text? – Darren Dec 30 '17 at 03:16
  • If you inspect the CSS used on the "site that managed to do it" you will notice they have used very different colors to yours. If you apply your colors to their site, it comes out as dark as you have observed (under Chrome) So try out their colors if you regard that as "good". If you simply change your text color from "black" #000 to "white" #fff you'll notice a huge difference. – TimBrownlaw Dec 30 '17 at 04:06

0 Answers0