The title attribute on a <canvas> tag adds a tooltip with title text to the canvas element.
Hovering the mouse over the canvas will display the tooltip.
A title attribute on a <canvas> element.
Hover over the canvas to see the tooltip.
<canvas title="This is a nice
blue canvas."
id="mycanvas" width="120" height="120">
</canvas>
<script>
( () => {
let canvas = document.getElementById("mycanvas");
let context = canvas.getContext("2d");
context.fillStyle = "lightblue";
context.fillRect(10, 10, 100, 100);
} )();
</script>
The title attributes provides additional information about the <canvas> element.
The title value can be seen as tooltip text.
Tooltips are shown when the canvas element is hovered.
<canvas title="value" >
Value | Description |
---|---|
value | A string value. A title can span multiple lines by including newline or carriage-return characters: or 
. |
Here is when title support started for each browser:
Chrome
|
4.0 | Jan 2010 |
Firefox
|
2.0 | Oct 2006 |
IE/Edge
|
9.0 | Mar 2011 |
Opera
|
9.0 | Jun 2006 |
Safari
|
3.1 | Mar 2008 |
Back to <canvas>