custom-highlight-painting-below-selection-ref.html (377B)
1 <!DOCTYPE html> 2 <meta charset="UTF-8"> 3 <style> 4 #highlighted { 5 background: cyan; 6 color: blue; 7 } 8 ::selection { 9 background: blue; 10 color: cyan; 11 } 12 </style> 13 <body><span id="highlighted">Text should be blue over cyan here and <span id="selected">cyan over blue here</span>.</span> 14 <script> 15 getSelection().setBaseAndExtent(selected, 0, selected, 1); 16 </script>