Change the style of selected text

Posted November 14th, 2009 by admin

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 :D !

Related posts:

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>