472,111 Members | 1,833 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,111 software developers and data experts.

IFrame align="center" in Netscape and Firefox

Hi!

I'm trying to set the align property/attribute of an IFrame to center
but its not working (see below). Can anyone please tell me what's going
on, and if there's a work around for this?

Thanks,

- Olumide

/////////////////// code //////////////////

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/>

<title>test</title>
</head>

<body>

<iframe src="sampleContent.htm" width="620" height="500"
align="center"></iframe>

</body>
</html>

Jul 24 '05 #1
1 13289
5...@web.de wrote:
Hi!

I'm trying to set the align property/attribute of an IFrame to center
but its not working (see below). Can anyone please tell me what's going on, and if there's a work around for this?

Thanks,

- Olumide

/////////////////// code //////////////////

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>test</title>
</head>

<body>

<iframe src="sampleContent.htm" width="620" height="500"
align="center"></iframe>

</body>
</html>


Use CSS, along with a proper doctype:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/>
<title>test</title>
<style type="text/css">

body {
text-align: center;
}
#foo {
display: block;
width: 620px;
height: 500px;
margin: 0 auto;
}

</style>
</head>
<body>
<iframe id="foo" src="sampleContent.htm"></iframe>
</body>
</html>

The body rule is for ie5win:

http://www.bluerobot.com/web/css/center1.html

Jul 24 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

14 posts views Thread by Torbjørn Pettersen | last post: by
11 posts views Thread by Ben Amada | last post: by
4 posts views Thread by Aaron Gray | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.