HTML Attributes

HTML height attribute

Build a form with the HTML form generator

Sets an element-specific height, commonly in CSS pixels. On images, pair it with width matching the intrinsic aspect ratio to reserve layout space. It is not a CSS length with units. Applicable elements include: <canvas>, <embed>, <iframe>, <img>, <input>, <object>, <source>, <video>. Check each element’s value rules.

Formal Syntax & Structure

html syntaxhtml
height="150"

Parameters & Attributes

NameTypeDescription
heightnon-negative integerSets an element-specific height, commonly in CSS pixels. On images, pair it with width matching the intrinsic aspect ratio to reserve layout space. It is not a CSS length with units.

Working Example

Example Snippethtml
<canvas width="300" height="150">Drawing area</canvas>
HTML Reference