custom-highlight-font-metrics-003.html (1231B)
1 <!DOCTYPE html> 2 <meta charset="UTF-8"> 3 <title>CSS Highlight API Test: </title> 4 <link rel="help" href="https://drafts.csswg.org/css-highlight-api-1/"> 5 <link rel="help" href="https://drafts.csswg.org/css-pseudo/#highlight-styling"> 6 <link rel="match" href="custom-highlight-font-metrics-003-ref.html"> 7 <meta name="assert" value="combining a font relative highlight with another highlight"> 8 <meta name="fuzzy" content="0-120;0-8"> 9 <head> 10 <style> 11 :root { 12 font-size: 16px; 13 } 14 div { 15 margin: 40px; 16 font-size: 20px; 17 } 18 ::selection { 19 background-color: transparent; 20 text-underline-offset: 0.5em; 21 text-decoration-line: underline; 22 text-decoration-color: green; 23 text-decoration-thickness: 0.25rem; 24 } 25 ::highlight(highlight1) { 26 text-decoration-line: overline; 27 text-decoration-color: green; 28 text-decoration-thickness: 4px; 29 } 30 </style> 31 </head> 32 <body> 33 <div id="h1">A green 10px offset underline 4px thick and green overline 4px thick</div> 34 <script> 35 getSelection().selectAllChildren(h1); 36 let r1 = new Range(); 37 r1.setStart(h1, 0); 38 r1.setEnd(h1, 1); 39 CSS.highlights.set("highlight1", new Highlight(r1)); 40 </script> 41 </body> 42 </html>