HTML <object> width Attribute
The HTML <object> width attribute is used to specify the horizontal dimension of the embedded object, defining the width of the displayed content within the webpage.
Syntax:
<object width="pixels">
Attribute Values:
- pixels: It holds the width of the object in terms of pixels.
The below example illustrates the <object> width attribute in HTML:
HTML <object> width attribute Example
Example: This example uses object width attribute to set the object width.
HTML
<!DOCTYPE html>
< html >
< head >
< title >HTML object width Attribute</ title >
</ head >
< body style = "text-align: center" >
< h2 >HTML object width Attribute</ h2 >
< object
id = "myobject"
width = "400"
height = "200"
data =
>
</ object >
</ body >
</ html >
|
Output:
Explanation:
- Above example utilizes the <object> tag with the width attribute set to 400 pixels and the height attribute set to 200 pixels to embed an image.
- The data attribute specifies the image source URL for display within the webpage.
HTML object width attribute Use-Case
In HTML5, use the width and height attributes within the <object> tag to specify the horizontal and vertical dimensions of embedded content, respectively, defining its display size.
Supported Browsers
The browser supported by HTML <object> width attribute are listed below:
Last Updated :
08 Mar, 2024
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...