doc_pseudo.html (2646B)
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <style> 6 body::before { 7 animation: body 100s infinite; 8 background-color: lime; 9 content: "body-before"; 10 width: 100px; 11 } 12 13 .div-before::before { 14 animation: div-before 100s infinite; 15 background-color: lime; 16 content: "div-before"; 17 width: 100px; 18 } 19 20 .div-after::after { 21 animation: div-after 100s infinite; 22 background-color: lime; 23 content: "div-after"; 24 width: 100px; 25 } 26 27 .div-marker { 28 display: list-item; 29 list-style-position: inside; 30 } 31 32 .div-marker::marker { 33 content: "div-marker"; 34 } 35 36 dialog::backdrop { 37 animation: dialog-backdrop 8.5s infinite; 38 } 39 40 ::view-transition-group(*), 41 ::view-transition-old(*), 42 ::view-transition-new(*) { 43 /* large number so the view-transition pseudo elements are available during the whole test */ 44 animation-duration: 3600s; 45 } 46 47 ::view-transition-group(my-vt) { 48 animation-name: my-vt-animation; 49 } 50 51 .div-view-transition { 52 view-transition-name: my-vt; 53 } 54 55 @keyframes body { 56 from { 57 opacity: 0; 58 } 59 to { 60 opacity: 1; 61 } 62 } 63 64 @keyframes div-before { 65 from { 66 opacity: 1; 67 } 68 to { 69 opacity: 0; 70 } 71 } 72 73 @keyframes div-after { 74 from { 75 opacity: 1; 76 } 77 50% { 78 opacity: 0.9; 79 } 80 to { 81 opacity: 0; 82 } 83 } 84 85 @keyframes my-vt-animation { 86 from { 87 rotate: 360deg; 88 } 89 to { 90 opacity: 0deg; 91 } 92 } 93 94 @keyframes dialog-backdrop { 95 from { 96 background-color: hotpink; 97 } 98 to { 99 background-color: gold; 100 } 101 } 102 </style> 103 </head> 104 <body> 105 <div class="div-before"></div> 106 <div class="div-after"></div> 107 <div class="div-marker"></div> 108 <div class="div-view-transition">Hello</div> 109 <dialog>My Modal</dialog> 110 111 <script> 112 "use strict"; 113 114 // The reason why we currently run the animation on `::marker` with Web Animations API 115 // instead of CSS Animations is because it requires `layout.css.marker.restricted` 116 // pref change. 117 document.querySelector(".div-marker").animate( 118 { 119 color: ["black", "lime"], 120 }, 121 { 122 id: "div-marker", 123 duration: 10000, 124 iterations: Infinity, 125 pseudoElement: "::marker", 126 } 127 ); 128 129 // show the dialog modal so the backdrop pseudo element node gets displayed 130 document.querySelector("dialog").showModal(); 131 </script> 132 </body> 133 </html>