Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing the highlight color when selecting text in an HTML text input

I've been looking for this throughout the web and can't even find anyone else even asking this, let alone a solution...

Is there a way to change the color of the highlight area within a text input when text is selected? Not the highlight border or the background, but the portion that appears around the text when you have the text actually selected.

like image 809
Eric Avatar asked Feb 13 '10 18:02

Eric


People also ask

How do you change the selected text color in HTML?

The colour of selected text can be easily changed by using the CSS | ::selection Selector. In the below code, we have used CSS ::selection on <h1> and <p> element and set its colour as yellow with green background.

How do you change the highlight color on selected text?

To change the highlight text colour, click the first box beside “Selected Text” and choose your preferred colour in the resulting colour panel and then click “Done”. Use the second box to change the highlight background colour.

How do you change the highlight text in HTML?

To change the color of the highlighted-text, simply target the ::selection selector and then define the color of the background property.


1 Answers

If you are looking for this:

alt text

Here is the link:

http://css-tricks.com/overriding-the-default-text-selection-color-with-css/

like image 191
Sarfraz Avatar answered Sep 25 '22 06:09

Sarfraz