strange behaviour of IFRAME under XHTML_Transitional in IE

A

Anna

Hi all.
I have a strange thing happening when using iframe.
Here is my small page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en">
<head>
<title>Test</title>
<meta http-equiv="content-type" content="text/html;
charset=utf-8"/>
</head>
<body>
<table>
<tr>
<td>
<iframe src="http://www.yahoo.com" height="100%">Your browser does
not support frames</iframe>
</td>
</tr>
</table>
</body>
</html>

The way it is written, the iframe is not shown in IE browser.
It IS shown in Netscape.
If I remove from the file EITHER the doctype declaration OR the height
attribute of the frame OR the table including the iframe (leaving
iframe the only content of body), the iframe starts to show up on IE.
I also checked this page with W3C HTMLValidator, and it is valid XHTML
Transitional.

So I am really confused and don't understand what's wrong here.

I will be really happy to get any input on this.

Thank you all very much for help.

Anna
 
D

DU

Anna said:
Hi all.
I have a strange thing happening when using iframe.
Here is my small page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en">
<head>
<title>Test</title>
<meta http-equiv="content-type" content="text/html;
charset=utf-8"/>
</head>
<body>
<table>
<tr>
<td>
<iframe src="http://www.yahoo.com" height="100%">Your browser does
not support frames</iframe>
</td>
</tr>
</table>
</body>
</html>

The way it is written, the iframe is not shown in IE browser.
It IS shown in Netscape.
If I remove from the file EITHER the doctype declaration OR the height
attribute of the frame OR the table including the iframe (leaving
iframe the only content of body), the iframe starts to show up on IE.
I also checked this page with W3C HTMLValidator, and it is valid XHTML
Transitional.

So I am really confused and don't understand what's wrong here.

I will be really happy to get any input on this.

Thank you all very much for help.

Anna

I confirm your findings. Somehow it seems the table is parsed and
rendered before the iframe actually loads the document. The 100% is
related to basically nothing.
The browsers will resort to different parsing logics when dealing with
documents triggering standards compliant rendering mode. This is the
case here too. It appears that in backward compatible mode, iframe have
a default width:300px and height:100px declaration (or so).
Whatever the explanation is, an iframe can never be considered as
tabular data; therefore, embedding an iframe in a table cell element
should not be used.

Consider that
<p style="border:2px solid red;"><iframe src="http://www.yahoo.com"
height="1%">[Your user agent does not support iframes or is currently
configured not to display iframes. If you're using Opera 6+, you can
enable iframe with File/Preferences...Alt+P/Page style/Enable inline
frames.]</iframe></p>
will create in MSIE 6 SP1 a paragraph using 100% of the available height
of the viewport (not the body element excluding margins as it should
be). Best is to stay away from %tage values for height for iframes.
Mozilla 1.6 final won't render that correctly but Opera 7.50 PR1 will
render the 1% height correctly though.

If you desperately need your iframe to use a %tage of the browser window
viewport, then there would be a way to do that with javascript.

DU
 
T

Toby A Inkster

DU said:
Whatever the explanation is, an iframe can never be considered as
tabular data; therefore, embedding an iframe in a table cell element
should not be used.

<table>
<caption>Cool Sites</caption>
<thead>
<tr>
<th>Website Name</th>
<th>Description</th>
<th>Preview</th>
<th>Link</th>
</tr>
</thead>
<tbody>
<tr>
<td>Yahoo</td>
<td>Categorised directory of web sites.</td>
<td><iframe src="http://www.yahoo.com/">Follow the link
instead.</iframe></td>
<td><a href="http://www.yahoo.com/">http://www.yahoo.com/</a></td>
</tr>
</tbody>
</table>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top