width (HTML attribute)

Spec
Depr. Version
No N/A

Syntax

width="width in pixels"

Example

The width attribute set to "200":

<embed src="giant-grasshopper.jpg" width="300"
height="100"></embed>

Description

An object does not require a width attribute but, like the height attribute, it has its uses (refer to the advantages set out in the height attribute reference).

If the width attribute is set by itself, but no height attribute is set, the embed content will be rescaled proportionally (assuming that the object is a simple image).

In every other respect, the width attribute is identical in usage/behavior as the height attribute.

Value

A number representing the width of the embedded object in pixels.

Compatibility

The compatibility of this attribute is dependent on the type of object. For image type objects, there is reasonable cross-browser support for the height attribute.

User-contributed notes

There are no comments yet.

Related Products