dir-pseudo-update-document-element.html (474B)
1 <!DOCTYPE html> 2 <html dir="ltr"> 3 <head> 4 <link rel="match" href="dir-pseudo-update-document-element-ref.html"> 5 <link rel="help" href="https://drafts.csswg.org/selectors-4/#the-dir-pseudo"> 6 <script> 7 document.documentElement.setAttribute('dir', 'rtl'); 8 </script> 9 <style> 10 div { 11 width: 100px; 12 height: 100px; 13 float: left; 14 } 15 16 div:dir(rtl) { 17 background-color: green; 18 } 19 20 div:dir(ltr) { 21 background-color: red; 22 } 23 </style> 24 </head> 25 <body> 26 <div></div> 27 </body> 28 </html>