selection-paint-image.html (714B)
1 <!doctype html> 2 <title>CSS Pseudo-Elements Test: Replaced content shown through selection</title> 3 <link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#highlight-replaced"> 4 <link rel="stylesheet" type="text/css" href="/fonts/ahem.css"> 5 <link rel="mismatch" href="selection-paint-image-notref.html"> 6 <style> 7 div { font: 100px/1 Ahem; } 8 img { vertical-align: top; } 9 ::selection { background-color: green; } 10 </style> 11 <p>The red image to the right should shine through the green selection.</p> 12 <div> <img src="support/100x100-red.png"></div> 13 <script> 14 let range = document.createRange(); 15 range.selectNodeContents(document.querySelector("div")); 16 window.getSelection().addRange(range); 17 </script>