HTML iframe Tag width Attribute Tutorial

In this section, we will learn what the width attribute is and how to use it.

What is width Attribute in HTML <iframe> Tag?

The height attribute is used to set the width of the target <iframe> element in a document.

The value we set for this attribute could be of any relative or absolute units we use in CSS.

For example, if we set the value of the width attribute to 400px, then its width becomes 400 CSS Pixel.

HTML width Attribute in <iframe> Tag Syntax:

<iframe src = “external-resource-url-address” width = “width-of-the-target-iframe”> </iframe>

<iframe> Tag width Attribute Values

The value we set for this attribute represents the width of the target <iframe> element.

Example: using width attribute in HTML <iframe> tag

See the Pen using width attribute in HTML <iframe> tag by Omid Dehghan (@odehghan) on CodePen.

For this particular example, the width of this <iframe> is set to 400px.

Facebook
Twitter
Pinterest
LinkedIn

Top Technologies