CSS3 Click Chart

Selection Pseudo-Element

Using a pseudo-element, allows you to change the text color or background color on selected text.


* Not in the spec

Example Code

Live Demonstration

Select the text in this paragraph. The background color and text color will change to purple and hotpink for the selected area.

Browser Support

Tools / Polyfills

Tutorials / Articles

::selection on MDN

Fork me on GitHub