highlight-painting-shadows-horizontal-ref.html (2256B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>CSS Pseudo-Elements Test: Shadows on highlights horizontal text - reference</title> 4 <link rel="author" name="Stephen Chenney" href="mailto:schenney@igalia.com"> 5 <style> 6 :root { 7 line-height: 1; 8 white-space: break-spaces; 9 } 10 #originating_shadow { 11 font-size: 2em; 12 color: transparent; 13 text-shadow: 0.1em 0.1em rgba(0,0,0,0.5); 14 position: absolute; 15 z-index: 0; 16 top: 10px; 17 left: 10px; 18 } 19 #originating_text { 20 font-size: 2em; 21 color: black; 22 position: absolute; 23 z-index: 7; 24 top: 10px; 25 left: 10px; 26 } 27 #selection_only { 28 font-size: 2em; 29 color: green; 30 text-shadow: -0.25em -0.25em rgba(0,128,0,0.5), 0.1em 0.1em rgba(0,0,0,0.5); 31 position: absolute; 32 z-index: 5; 33 top: 10px; 34 } 35 #target { 36 font-size: 2em; 37 color: blue; 38 text-shadow: 0.25em 0.25em rgba(0,0,128,0.5), 0.1em 0.1em rgba(0,0,0,0.5); 39 position: absolute; 40 z-index: 3; 41 top: 10px; 42 } 43 #both_text { 44 font-size: 2em; 45 color: green; 46 position: absolute; 47 z-index: 4; 48 top: 10px; 49 } 50 #both_shadow { 51 font-size: 2em; 52 color: transparent; 53 text-shadow: 0.25em 0.25em rgba(0,0,128,0.5), -0.25em -0.25em rgba(0,128,0,0.5), 0.1em 0.1em rgba(0,0,0,0.5); 54 position: absolute; 55 z-index: 2; 56 top: 10px; 57 } 58 </style> 59 <p id="originating_shadow">part</p> 60 <p id="originating_text">part</p> 61 <p id="selection_only">ially selected </p> 62 <p id="both_text">ta</p> 63 <p id="both_shadow">ta</p> 64 <p id="target">rget</p> 65 <script> 66 originatingCS = getComputedStyle(originating_text); 67 selection_only.style.left = (parseFloat(originatingCS.width) + parseFloat(originatingCS.left)).toString() + "px"; 68 selectionCS = getComputedStyle(selection_only); 69 both_text.style.left = (parseFloat(selectionCS.width) + parseFloat(selectionCS.left)).toString() + "px"; 70 both_shadow.style.left = both_text.style.left; 71 bothCS = getComputedStyle(both_text); 72 target.style.left = (parseFloat(bothCS.width) + parseFloat(bothCS.left)).toString() + "px"; 73 </script>