- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to make graphics with a script in HTML?
To make graphics with a script, use the <canvas> tag. The HTML <canvas> tag is for drawing graphics, animations, etc using scripting.
The following are the attributes of the <canvas> tag −
|height ||pixels||Specifies the height of the canvas.|
|width ||pixels||Specifies the width of the canvas.|
You can try to run the following code to implement <canvas> tag and create graphics −
<!DOCTYPE html> <html> <head> <title>HTML Canvas Tag</title> </head> <body> <canvas id = "newCanvas">Your browser does not support canvas tag.</canvas> <script> var c = document.getElementById('newCanvas'); var ctx = c.getContext('2d'); ctx.fillStyle = '#00AEEF'; ctx.fillRect(0,0,180,50); </script> </body> </html>
- Use HTML with jQuery to make a form
- How do we display a script in HTML?
- How to work with Scalable Vector Graphics (SVG) in HTML5?
- Enclose a text to make it blink with HTML.
- How to make a div center align in HTML?
- How to make text bold in HTML?
- How to make text italic in HTML?
- HTML DOM Script Object
- Draw a line in C++ graphics
- Menu not visible in IE8. How to make it visible with HTML?
- Execute a script when a user navigates to a page in HTML?
- How to make page links in HTML Page?
- How to make an image responsive in HTML?
- How to set the script to be executed asynchronously in HTML?