Change Color of Selected Text


/ Published in: CSS
Save to your folder(s)

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


Copy this code and paste it in your HTML
  1. ::-moz-selection
  2. {
  3. background:#6374AB;
  4. color:#fff;
  5. }
  6.  
  7. ::selection
  8. {
  9. background:#6374AB;
  10. color:#fff;
  11. }

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.