CSS Browser Text Selection Color Change - UXINME

CSS Browser Text Selection Color Change

October 27th, 2014 | CSS | Kumar Gaurav

This CSS trick will allow you to change color of browser default text selection. As of now this works in Mozilla, Safari, Chrome or any Webkit browser. If you have your website working on IE then it will fallback to its default blue color.

Just copy following code and paste in to your CSS file and see the magic!


/* Mozilla based browsers */
::-moz-selection {
       background-color: #FFA;
       color: #000;
}

/* Works in Safari */
::selection {
       background-color: #FFA;
       color: #000;
}