custom-highlight-container-metrics-001.html (1035B)
1 <!DOCTYPE html> 2 <meta charset="UTF-8"> 3 <title>CSS Highlight API Test: Highlights using container sizes</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="help" href="https://drafts.csswg.org/css-conditional-5/#container-lengths"> 7 <link rel="match" href="custom-highlight-container-metrics-001-ref.html"> 8 <meta name="assert" value="lengths depending on containers take the correct values in a universal highlight with no container"> 9 <head> 10 <style> 11 div { 12 width: 200px; 13 height: 100px; 14 } 15 ::highlight(highlight1) { 16 text-underline-offset: 1cqw; 17 text-decoration-line: underline; 18 text-decoration-color: green; 19 text-decoration-thickness: 2cqh; 20 } 21 </style> 22 </head> 23 <body> 24 <div id="h1">With container size</div> 25 <script> 26 let r1 = new Range(); 27 r1.setStart(h1, 0); 28 r1.setEnd(h1, 1); 29 CSS.highlights.set("highlight1", new Highlight(r1)); 30 </script> 31 </body>