margins inside the iframe


margin: ***;

Browser
Internet Explorer Firefox Opera

The margin property sets the margins around an element.

The margins inside the iframe can be set by applying this property to the BODY element.


body {
margin: 20px;
}

Apply this style to the BODY element of the page to load into the iframe.


Property Value Explanation
margin length, %, or auto the top, bottom, left, and right margins

Example

The page that sets the iframe

<html>
<head>
<title>TAG index</title>

<style type="text/css">

iframe {
width: 300px;
height: 150px;
}

</style>

</head>
<body>

<p><iframe src="example.html">Alternate content</iframe></p>

</body>
</html>

The page to load into the iframe (example.html)

<html>
<head>
<title>TAG index</title>

<style type="text/css">

body {
margin: 0 40px;
padding: 0;
background-color: #ffffff;
text-align: center;
color: #000000;
}

</style>

</head>
<body>

<p>This is example text ...</p>
<p>IFRAME</p>
...

</body>
</html>
Output