HTML iframe Tag height Attribute Tutorial

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

What is height Attribute in HTML <iframe> Tag?

The height attribute is used to set the height 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 height attribute to 500px, then its height becomes 500 CSS Pixel.

HTML height Attribute in <iframe> Tag Syntax:

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

<iframe> Tag height Attribute Values

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

Example: using height attribute in HTML <iframe> tag

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

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

Leave a Reply