---
title: "What the use of Canvas Element in HTML5"  
description: "What the use of Canvas Element in HTML5"  
author: "AVADHESH PATEL"  
published: 2012-10-20  
updated: 2020-09-23  
canonical: https://www.mindstick.com/interview/1550/what-the-use-of-canvas-element-in-html5  
category: "html5"  
tags: ["html5"]  
reading_time: 1 minute  

---

# What the use of Canvas Element in HTML5

The canvas element is used to draw graphics images on a web page by using javascript like below\
<canvas id="pcdsCanvas" width="500" height="400"></canvas> <script type="text/javascript">\
var pcdsCanvas=document.getElementById("pcdsCanvas");\
var pcdsText=pcdsCanvas.getContext("2d");\
pcdsText.fillStyle="#82345c";\
pcdsText.fillRect(0,0,150,75);\
</script>

## Answers

### Answer by AVADHESH PATEL

The canvas element is used to draw graphics images on a web page by using javascript like below\
<canvas id="pcdsCanvas" width="500" height="400"></canvas> <script type="text/javascript">\
var pcdsCanvas=document.getElementById("pcdsCanvas");\
var pcdsText=pcdsCanvas.getContext("2d");\
pcdsText.fillStyle="#82345c";\
pcdsText.fillRect(0,0,150,75);\
</script>


---

Original Source: https://www.mindstick.com/interview/1550/what-the-use-of-canvas-element-in-html5

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
