Open In App

HTML | <iframe> width Attribute

Last Updated : 06 May, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

The HTML <iframe> width attribute is used to specify the width of the <iframe> in terms of pixels. 

Syntax: 

<iframe width="pixels">

Attribute Values: It contains a single value pixel that specifies the iframes’ width in terms of pixels. 

Usage

  • The <iframe> tag is used to embed another webpage or content (like videos, maps) within the current page.
  • It uses the src attribute to specify the URL of the content to display.
  • Commonly used for embedding YouTube videos, Google Maps, or external web pages.

The example below illustrate the use of <iframe> width attribute in HTML: 

html
<!DOCTYPE html> 
<html> 
<head>
    <title>
        HTML iframe width Attribute
    </title>
</head>
<body style="text-align:center;">
     
    <h1 style="color:green;">
        GeeksforGeeks
    </h1>
    
    <h2>
        HTML iframe width Attribute
    </h2>
    <iframe src="https://www.geeksforgeeks.org/community/"
            height="250" width="400"></iframe> 
</body> 

</html>


Note: The content in the iframe isn’t showing because the website has blocked it for security reasons. You can try using a different link that allows embedding.

Supported Browsers: The browser supported by HTML iframe width attribute are listed below:

  • Google Chrome 1 and above
  • Edge 12 and above
  • Internet Explorer
  • Firefox
  • Safari
  • Opera

Next Article

Similar Reads