Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Pseudo-Elements Test: transparent ::selection background-color</title>
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<link rel="mismatch" href="selection-background-color-transparent-notref.html">
<meta name="assert" content="An author-specified transparent ::selection background-color wins over the UA origin, so the selection is not painted using the default highlight background.">
<script src="support/selections.js"></script>
<style>
div {
font-size: 300%;
}
div::selection {
background-color: transparent;
}
</style>
<p>Test passes if "Selected Text" does <strong>not</strong> appear selected using the OS selection background color.
<div id="test">Selected Text</div>
<script>selectNodeContents(document.getElementById("test"));</script>