details-open-pseudo-002.html (654B)
1 <!DOCTYPE html> 2 <html class="reftest-wait"> 3 <meta charset="utf-8"> 4 <title>test for details:open pseudoclass</title> 5 <link rel="match" href="details-open-pseudo-001-ref.html"> 6 <link rel="help" href="https://drafts.csswg.org/selectors-4/#open-state"> 7 8 <style> 9 details { 10 color: blue; 11 } 12 :open { 13 color: green; 14 margin-left: 5em; 15 } 16 </style> 17 18 <script> 19 function run() { 20 document.querySelector("details").open = true; 21 document.documentElement.classList.remove("reftest-wait"); 22 } 23 </script> 24 25 <body onload="run()"> 26 27 <p>The details element should be open, green, and indented:</p> 28 29 <details> 30 <summary>Summary</summary> 31 <p>Detailed content</p> 32 </details>