Dofactory.com
Dofactory.com
Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

HTML <object> width Attribute

The width attribute on an <object> tag sets the width of the object element.

The width is specified in pixels -- without the ‘px‘ unit.

Example

#

A width attribute on an <object> element.
This object has a width attribute and a CSS width property; CSS width takes precedence, i.e. wins.

<object data="/media/sample.pdf" type="application/pdf"
        width="800" height="450" style="width:100%">
</object>

Using width

The width attribute sets the width of the object.

The width is defined in pixels, without the 'px' extension.

To define the width in % or other unit, use the CSS width property.


Syntax

<object data="value" width="pixels">

Note: The width attribute requires that data has a value.

Values

#

Value Description
pixels A number (e.g. 500).

Browser support

Here is when width support started for each browser:

Chrome
1.0 Sep 2008
Firefox
1.0 Sep 2002
IE/Edge
1.0 Aug 1995
Opera
1.0 Jan 2006
Safari
1.0 Jan 2003

You may also like

 Back to <object>

Last updated on Sep 30, 2023

Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

Guides