selection styles

Supported by Mozilla and Safari.

Discuss this page.

It's possible to define color and background for text the user selects.

Try it in this page. If you select something and it looks like this, your browser supports selection styles.

Testsheet:

::-moz-selection{
	background:#6374AB;
	color:#fff;
}

::selection {
	background:#6374AB;
	color:#fff;
}

code::-moz-selection {
	background: #333333;
}

code::selection {
	background: #333333;
}

Of course Mozilla needs a special ::-moz-selection selector, while Safari keeps it simple. The selector only seems to accept color and background. I defined a grey background for code elements with the code::[-moz-]selection syntax.