2

I am working with a simple table-based layout that uses iFrames as depicted in the example below. This code is rendering well in all modern browsers. The iFrames are usually filled with long tables of data, but there is no odd behavior or clipping.

My concern is that it LOOKS like a really bad hack to me. Table-based layout evils aside, should I be worried about deprecation of all the width="100%" height="100%" attributes to HTML and iFrame tags?

I know that CSS can do most, if not all of this, but I don't want to use float hacks and I haven't been able to nail anything down that works in all modern browsers.

To be clear, I am looking for opinions and suggestions as to whether this solution is adequate for the next few years, or whether I should go ahead and delve into CSS hacks.

Thank you for any feedback.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled</title>
 <style type="text/css">
   <!--
    html, body
    {
      height: 100%;
      margin: 0px;
    }
    -->
 </style>
</head>
<body>
   <table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%">
    <tr>
        <td colspan="2"><div align="center">This is the header.</div></td>
    </tr>
    <tr>
        <td height="100%">
            <iFrame src="pane1.php" width="100%" height="100%" frameborder="0"></iframe>
        </td>
        <td height="100%">
            <iFrame src="pane2.php" width="100%" height="100%" frameborder="0"></iframe>
        </td>
    </tr>
    <tr>
        <td colspan="2">This is the footer.</td>
    </tr>
   </table>
</body>
</html>
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Fred Wilson
  • 2,177
  • 3
  • 17
  • 21

4 Answers4

2

I don't see anything that's going to be removed from any browser in the next few (or several) years.

The table tag is a valid and needed set of tags. Without it, there's no way to display tabular data.

What happened was people started exploiting it to display very intricate layouts which ended up being impossible to maintain.

No one's going to shoot you for using tables in the fashion you're using. It's super simple, and does the job whily you're developing, so consider it simply an iteration. Iterative development is good. Once you figure out a CSS-based layout, the code here is simple enough to replace.

supergalactic
  • 497
  • 6
  • 17
  • Yeah, the lazy coder in me agrees with you. It is a very simple layout and I just think that if IE played a little more nicely with the spec, I'd just go with pure CSS. With a bit more knowledge, I might be able to isolate the bug.. it's just so random I fled back to tables. ;) – Fred Wilson Apr 17 '09 at 23:16
1

It would probably be best to move to css styles if you are concerned about deprecation. You can still use the table layout if you are more comfortable though I prefer floating divs.

Jeremy
  • 6,580
  • 2
  • 25
  • 33
  • I have a version of this running with pure CSS. It is unfortunate that the left iFrame sometimes disappears in IE for no apparent reason. I suppose as long as: and are supported, the lame table solution will do the trick. I feel lazy about not getting the CSS to work in IE. Thank you for the reply! – Fred Wilson Apr 17 '09 at 17:47
  • You are going to get very different results if you use the first doctype (incomplete - essentially the same as no doctype) vs. the second doctype. Floats with percentages and overflow:auto or overflow: scroll should give you approximately the same results without tables. – Traingamer Apr 17 '09 at 18:19
  • You are right.. there were some different results! :o) The original pure CSS solution worked really well until the day my client opened the page in IE7 on Vista Home Basic. The left iFrame was just not there. On every other browser, including IE7 on Vista Ultimate (and it was the same browser version too!) it worked fine. The only way to quiet the client in a pinch was to quickly revert to the lame table solution. Bleh.. and thanks for the comment! – Fred Wilson Apr 17 '09 at 18:40
1

To my knowledge, there is no danger of the tag becoming deprecated. And I have it from a very good source!

see Are IFrames (HTML) obsolete?

Community
  • 1
  • 1
Peter
  • 47,963
  • 46
  • 132
  • 181
0

Deprecation means that the features will not be present in future version of (X)HTML. So far all the browsers are supporting old versions of HTML, but I wouldn't rely on that myself.

All of what you're doing and much more can be done with CSS, without using hacks. Going through the exercise will help you maintain relevant skills. The page you have right now takes two extra HTTP requests to display; whether this is a concern depends how many people are requesting the page.

Scott
  • 6,411
  • 6
  • 39
  • 43
  • I agree that maintaining the relevant skills is very important. In this application, iFrames seem to work best due to the workflow spec'd for the app. Each side has grids that lead to forms, etc., and they need to work without refreshing the whole page. I'd put the iFrames in a DIV, but a bug in IE (and IE only) makes this a serious pain because the left iFrame will sometimes disappear for no apparent reason. Apologies if I am missing the point. – Fred Wilson Apr 17 '09 at 23:14