HTML Attributes
HTML height attribute
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
| Name | Type | Description |
|---|---|---|
| height | non-negative integer | 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. |
Working Example
Example Snippethtml
<canvas width="300" height="150">Drawing area</canvas>