We Recommend

CSS: The Definitive Guide CSS: The Definitive Guide
Provides you with a comprehensive guide to CSS implementation, along with a thorough review of all aspects of CSS 2.1. Updated to cover Internet Explorer 7, Microsoft's vastly improved browser, this new edition includes content on positioning, text wrapping (nowrap), lists and generated content, table layout, user interface, paged media, and more.


Posted By

neal_grosskopf on 12/07/07


Tagged

css selection CSS3


Versions (?)


Who likes this?

6 people have marked this snippet as a favorite

copyleft
SpinZ
sbbath
stoker
neal_grosskopf
Mithun


Change Color of Selected Text


Published in: CSS 


URL: http://www.quirksmode.org/css/selection.html

Change the color and background color of selected text using only css. Compatible with Firefox and Safari, but not Internet Explorer

  1. ::-moz-selection
  2. {
  3. background:#6374AB;
  4. color:#fff;
  5. }
  6.  
  7. ::selection
  8. {
  9. background:#6374AB;
  10. color:#fff;
  11. }

Report this snippet 

Comments

RSS Icon Subscribe to comments
Posted By: Mithun on July 22, 2008

Thank you

You need to login to post a comment.