Status: PASS | Duration: 7ms | Subtests: 1/1 | Open test on wpt.live | Open ref on wpt.live | wpt.fyi
/css/css-conditional/container-queries/container-units-selection-pseudo.html
<!DOCTYPE html> <title>Container-relative units in ::selection</title> <link rel="help" href="https://drafts.csswg.org/css-conditional-5/#container-lengths"> <link rel="match" href="container-units-selection-pseudo-ref.html"> <style> #outer, #inner { container-type: size; } #outer { width: 200px; height: 200px; border: 1px solid black; } #inner { width: 100px; height: 100px; background-color: skyblue; } #inner::selection { background-color: seagreen; text-decoration: underline solid; text-underline-offset: 10cqh; } </style> <div id=outer> <div id=inner> Some text </div> </div> <script> let range = document.createRange(); range.selectNode(inner); window.getSelection().addRange(range); </script>
/css/css-conditional/container-queries/container-units-selection-pseudo-ref.html
<!DOCTYPE html> <title>Container-relative units in ::selection (ref)</title> <link rel="help" href="https://drafts.csswg.org/css-conditional-5/#container-lengths"> <style> #outer { width: 200px; height: 200px; border: 1px solid black; } #inner { width: 100px; height: 100px; background-color: skyblue; } #inner::selection { background-color: seagreen; text-decoration: underline solid; text-underline-offset: 10px; } </style> <div id=outer> <div id=inner> Some text </div> </div> <script> let range = document.createRange(); range.selectNode(inner); window.getSelection().addRange(range); </script>