A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/html/attributes/width below:

width ยท WebPlatform Docs

width Summary

Specifies the width, in pixels, of certain content elements.

Applies to [HTMLImgElement](/html/elements/img)

The **width** attribute specifies the visual width of [img](/html/elements/img), [iframe](/html/elements/iframe), [embed](/html/elements/embed), [object](/html/elements/object), [video](/html/elements/video), [canvas](/html/elements/canvas), and [input[type="image"]](/html/elements/input/type/image) in pixels.

By default, elements will not preserve aspect ratio when width attribute is set, without a height attribute. If a width attribute is set, but no height, an image will scale to preserve its original aspect ratio. If both the width and height are zero, the element should not be intended to be visible by the user.

Width values must be non-negative integers.

Examples

<img> with width attribute.

<img src="/logo/wplogo_transparent_xlg.png" height="100" width="150">

View live example

<canvas> with width attribute

<canvas width="200" height="200"></canvas>

View live example

Related specifications
HTML4 Specification
W3C Recommendation
Attributions

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4