scroll-to-text-diretive-center.html (1192B)
1 <!DOCTYPE html> 2 <meta charset="utf-8" /> 3 <title>URL Fragment Text Directives: Scrolling to a text directive should center it in the block flow direction</title> 4 <link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com"> 5 <link rel="help" href="https://wicg.github.io/scroll-to-text-fragment/#invoking-text-directives"> 6 <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> 7 <link rel="match" href="scroll-to-text-diretive-center-ref.html"> 8 <style> 9 .container { 10 overflow: scroll; 11 scrollbar-width: none; 12 width: 200px; 13 height: 150px; 14 position: absolute; 15 top: 0; 16 left: 0; 17 } 18 ::target-text { 19 color: red; 20 } 21 </style> 22 <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> 23 <div style="position: relative;"> 24 <div id="container1" class="container"> 25 <div style="height: 1000px;"></div> 26 <div style="position: absolute; left: 0; top: 500px; font: 100px/1 Ahem;">X</div> 27 </div> 28 <div id="container2" class="container" style="place-content: center;"> 29 <div style="background: green; width: 100px; height: 100px;"></div> 30 </div> 31 </div> 32 <script> 33 window.location.hash = "#:~:text=X"; 34 </script>