HTML Tags: Canvas and SVG

These are the HTML tags you use to make graphics.

TagTypeDescription
<canvas>InlineUsed to draw graphics with canvas scripting API or WebGL API
<svg>InlineUsed to draw graphics using SVG

<canvas>

Used to draw graphics with canvas scripting API or WebGL API.

Possible attributes

  • height=[...]height of the canvas
  • width=[...]width of the canvas
| LIVE PREVIEW

If nothing appears below, refresh the page.

An alternative text describing what your canvas displays. the SVG viewport coordinates, i.e. minX minY width height
  • height=[...]the displayed height (viewport height)
  • width=[...]the displayed width (viewport width)
  • x=[...]at which x coordinate a nested <svg> should be put (no effect if given to the outhermost <svg>)
  • y=[...]at which y coordinate a nested <svg> should be put (no effect if given to the outhermost <svg>)
  • preserveAspectRatio=[...]indicates how to fit the viewbox (internal coordinate system) to the viewport (the displayed width and height). The default value is xMidYMid meet. (See possible values here)
  • | LIVE PREVIEW

    References