Text Selection Color

February 1, 2011

A lesser know property of CSS3 is the selection property. This allows you to change the properties of text when selected so you can highlight it in any way you want

1/* Webkit */ ::selection { background: #000; } /* Firefox */ ::-moz-selection { background: #000; } 

This sentence should highlight in black. And this in red.

Don't forget that some browsers won't show this as it's CSS3


Other posts


Tagged in: