canvas.2d.direction.inherit.style.html (926B)
1 <!doctype HTML> 2 <meta charset="utf-8"> 3 <title>HTML5 Canvas Test: The direction attribute inherits from the canvas style</title> 4 <link rel="match" href="canvas.2d.direction-ref.html" /> 5 <link rel="author" href="mailto:schenney@chromium.org"/> 6 <link rel="help" href="https://html.spec.whatwg.org/multipage/canvas.html#text-styles"/> 7 <meta name="assert" content="When the canvas element has a direction CSS property it should override the dir attribute." /> 8 <script type="text/javascript"> 9 function runTest() { 10 var canvas = document.getElementById("canvas1"); 11 var ctx = canvas.getContext("2d"); 12 13 // The default for direction is inherit 14 ctx.font = "25px serif"; 15 ctx.fillText("ABC!", 60, 50); 16 } 17 </script> 18 <style> 19 canvas { 20 direction: rtl; 21 } 22 </style> 23 <body onload="runTest()"> 24 <canvas dir="ltr" id="canvas1" width="300" height="150"> 25 Browser does not support HTML5 Canvas. 26 </canvas> 27 </body>