HTML Attributes

HTML width attribute

Build a form with the HTML form generator

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

NameTypeDescription
widthnon-negative integerDefines 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>
HTML Reference