HTML width attribute
width attribute represents the horizontal dimension of the media, iframe, image or video.
<img src="files/web.png" width="100%" height="400">
</>
Attribute values
All possible values of accept attributeThe value of width attribute is a positive integer. By default, the unit of width is pixels. 400 means 400px.
CSS properties may also be applied to define the width.
<img src="URL" style="width:100%; height:200px;">
Related Tags
The tags that support accept attribute<embed> tag
-
It embeds external resources such as image, HTML page.
-
<embed src="URL" width="100%" height="300">
<iframe> tag
-
iframe represents a browsing context to browse the content.
-
<iframe src="URL" style="width:100%; height:200px;"> </iframe>
<img> tag
-
img tag adds an image in the page. img element supports the width attributes.
<video> tag
-
video tag adds an image in the page. width defines horizontal dimension.
-
<video src="URL" height="500" width="100%"> </video>
Previous
Was this article helpful?