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 03/09/08


Tagged

css CSS3


Versions (?)


Who likes this?

3 people have marked this snippet as a favorite

neal_grosskopf
SpinZ
Wiederkehr


Change Text Selection Color Using CSS


Published in: CSS 


URL: http://www.nealgrosskopf.com/tech/thread.asp?pid=5

Change selection color using CSS. Works in most modern browsers except for IE.


  1. ::selection { background: red; color: white; }
  2. ::-moz-selection { background: red; color: white; }

Report this snippet 

Comments

RSS Icon Subscribe to comments
Posted By: neal_grosskopf on March 10, 2008

The -moz selector is still in beta stage for firefox but the ::selection selector is valid CSS3. The CSS validator hasn't been update yet for CSS3.

Posted By: SmpleJohn on March 10, 2008

Kind of nice, doesn't validate with W3C though.

You need to login to post a comment.