BLOG

web design html interactive web designer css3 responsive design front-end javascript SEO friendly design web marketing

How to Change the Default Text Selection Color with CSS

Fabrizio Michels - Thursday, October 27, 2011

If you want to change your website's default text highlight color with any color of your choice, you can use the CSS3 declaration " ::selection" , which will replace your browser-level default text highlight color with a color that better suits your design.

See the example below with a RED for the background and WHITE for the text.

/* Firefox */
::-moz-selection {
       background
-color: #FF0000;
       color
: #fff;
}

/* Safari */
::selection {
       background
-color: #FF0000;
       color
: #ff;
}
Comments
Post has no comments.