HTML Attributes
HTML width attribute
Defines element-specific width, commonly in CSS pixels. On images it can establish an intrinsic aspect ratio together with height; on canvas it sets the bitmap width. Applicable elements include: <canvas>, <embed>, <iframe>, <img>, <input>, <object>, <source>, <video>. Check each element’s value rules.
Formal Syntax & Structure
html syntaxhtml
width="320"Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| width | non-negative integer | Defines element-specific width, commonly in CSS pixels. On images it can establish an intrinsic aspect ratio together with height; on canvas it sets the bitmap width. |
Working Example
Example Snippethtml
<canvas width="320" height="180">Drawing area</canvas>