Posts

How to use canvas element to draw simple rectangle?

Image
Hey Buddy, Hope you are doing well. 😄    Today, We are going to learn. "How to use the canvas element to draw simple rectangle". With 9 simple steps and you will get below output. Step 1: Open any Text Editor. Step 2: Create a simple web page. Step 3: Add canvas element and style it. Step 4: Add script tag. Step 5: Select canvas element by id selector. Step 6: Get canvas context and set its width and height. Step 7: Set Rectangle color, location, width & height. Step 8: Save the web page. Step 9: View the Result. Thanks...