CSS: Changing The Default background and Text Selection Color

The text selection CSS3 pseudo-element will allow you to change the default text and background color when the content is being selected. Currently supported by FireFox, Safari, Chrome, IE9+ and Opera support. Browsers that don’t support it will ignore the code.

Try it out! on your next project just add the following selectors to your CSS stylesheet.

::selection { background:#CCD0DB; color:#000}
::-moz-selection {background:#CCD0DB;color:#000}
::-webkit-selection { background:#CCD0DB; color:#000}

Other properties that can be applied are: cursor and outline.


Leave a Reply

Your email address will not be published. Required fields are marked *