HTML <iframe> width Attribute

Last Updated : 27 May, 2026

The width attribute is used to specify the width of an <iframe> element. It controls the horizontal size of the embedded frame on a webpage.

  • Defines the width of the <iframe> in pixels.
  • Commonly used with the height attribute for proper frame dimensions.
  • The <iframe> tag is used to embed external content like webpages, videos, and maps.

Syntax: 

<iframe width="pixels">

Attribute Values: The pixels value specifies the width of the iframe in pixels.

html
<!--Driver Code Starts-->
<!DOCTYPE html> 
<html> 
<head>
    <title>
        HTML iframe width Attribute
    </title>
</head>
<!--Driver Code Ends-->

<body style="text-align:center;">
     
    <h1 style="color:green;">
        GeeksforGeeks
    </h1>
    
    <h2>
        HTML iframe width Attribute
    </h2>
    <iframe src="https://media.geeksforgeeks.org/wp-content/uploads/20210910170539/gfg-221x300.png"
            height="250" width="400"></iframe> 
</body> 

<!--Driver Code Starts-->

</html>
<!--Driver Code Ends-->

Note: The iframe content may not load because some websites block embedding for security reasons.

Comment