How to Set Text Selection Color with CSS

28 September 2011 by Rick ~ 0 Comments 538 views

CSS

With this useful piece of CSS you can change color and background of the selected text.

Yes! Give it a try and select some text ;)

/* Mozilla based browsers */
::-moz-selection {
      background-color: #FFA;
      color: #000;
}
/* Works in Safari */
::selection {
      background-color: #FFA;
      color: #000;
}

Subscribe by E-mail:

« »
Add a Comment

Use [code] example piece of code [/code] to insert code into your comment.