Change the colour of highlighted text

Hi all! I’m new to Webflow :slight_smile:

Does anyone know how a I can change the colour of the background of a highlighted text? I found an old question (Change highlighted text color) and tried to enter the code in the custom code section as suggested by @perkristian . Unfortunately, it doesn’t seem to work at all! Any suggestions? Thanks a lot

1 Like

Hi there,

just add this code in the Head, changing “colour” for the hexadecimal value you want (the first one is the text, the second the highlighted background):

 <style>
 ::selection {color: #colour; background: #colour;}
 </style>
16 Likes

Thanks a lot! Worked perfectly :slight_smile:

2 Likes

This is awesome thanks!

Is there a way to also make it change on mobile?

::selection currently has full support

(::selection - CSS: Cascading Style Sheets | MDN)

[See ::selection on MDN] ::selection - CSS: Cascading Style Sheets | MDN

1 Like