Change the style of selected text

I recently learned this neat little css snippet that allows you to style selected text (this only works in Firefox… but really… what else matters? 😉 )

Just put the following code somewhere into your stylesheet making sure to change the background and color to match your own design! For an example of this code in action just select some of the text here on my site :)

*::-moz-selection { background: #000 none repeat scroll 0 0; color: #fff; }

Update!

This same effect can be used in Safari as well by including the following code:

::selection { background: #000 none repeat scroll 0 0; color: #fff; }

Thanks to Andrew Houle of myinkblog.com for that tip 😀 !