14
Jul
2009

Change the style of selected text

Author: dani
Web designer/front-end web developer who hugs trees, loves animals, and is totally addicted to social media. :) Find me @ danimcdaniel.com or tweet me @dani!
Bluehost.com Web Hosting $6.95

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 !

Subscribe to RSS feedShow me some social luv
  • Digg this!
  • Stumble This!
  • Float This!
  • Bump This!
  • Click to bookmark this page on Reddit!
  • Share on Facebook!
  • Tweet This
  • Bookmark this site!
  • Subscribe to RSS Feed

22 Comments

 

High Res Textures at Go Media

 
My Tools of the Trade
My Recent Tweets