Open In App

HTML <iframe> marginwidth Attribute

Last Updated : 04 Oct, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

The HTML <iframe> marginwidth attribute defines the horizontal margin space, in pixels, between the iframe's content and its left and right borders.

Syntax

<iframe marginwidth="pixels">

Attribute Values:

  • pixels: It contains the value i.e. pixel which specifies the right and left margin of the content in an Iframe Element.

Note:This attribute is not supported in HTML 5, as a replacement you can use CSS.

Below example illustrate the <iframe> marginwidth Attribute:

Example: In this example we showcases the <iframe> with a marginwidth attribute, providing horizontal spacing of 50 pixels. It includes a centered title, subtitle, and embedded content from GeeksforGeeks.

html
<!DOCTYPE html>
<html>

<head>
    <title>
        HTML iframe marginwidth Attribute
    </title>
</head>

<body>
    <center>
        <h1 style="color:green;">
            GeeksforGeeks
        </h1>
        <h2>
            HTML Iframe marginwidth Attribute
        </h2>

        <p>Content goes here</p>

        <iframe src="https://ide.geeksforgeeks.org/tryit.php" 
                height="200" 
                width="400" 
                marginwidth="50">
        </iframe>
    </center>

</body>

</html>

Output:

Supported Browsers

The browsers supported by HTML <iframe> marginwidth Attribute are listed below:


Next Article

Similar Reads