Html 整版iframe

Html 整版iframe,html,iframe,footer,Html,Iframe,Footer,我需要一个标题和iframe显示从其他网站的页面。 以下是我使用的: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <s

我需要一个标题和iframe显示从其他网站的页面。 以下是我使用的:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
<head> 
    <style type="text/css"> 
    *{margin:0;padding:0} 
    html, body {height:100%;width:100%;overflow:hidden} 
    table {height:100%;width:100%;table-layout:static;border-collapse:collapse} 
    iframe {height:100%;width:100%} 
    .header2 {border-bottom:1px solid #000;height:90px;} 
    .content2 {height:100%} 
</style> 
</head> 
<body>
<table>
<tr>
    <td class="header2">
    asdasdasdasd
    </td>
</tr>
<tr>
    <td class="content2">
        <iframe src="http://www.w3schools.com" scrolling="auto" frameborder="1" />
    </td>
</tr>
</table>
</body>
</html>

*{边距:0;填充:0}
html,正文{高度:100%;宽度:100%;溢出:隐藏}
表{高度:100%;宽度:100%;表布局:静态;边框折叠:折叠}
iframe{高度:100%;宽度:100%}
.header2{边框底部:1px实心#000;高度:90px;}
.content2{高度:100%}
asdasdasd

问题是这段代码没有显示页脚完整(由于页眉部分,90个像素超出了页面)。表伤了我的眼睛<代码>位置:绝对在这方面被严重低估。请尝试此布局:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Test Layout</title>
        <style type="text/css">
            body, html
            {
                margin: 0; padding: 0; height: 100%; overflow: hidden;
            }
            #header
            {
                position:absolute; left: 0; top: 0; right: 0; height: 90px; background: red;
            }
            #content
            {
                position:absolute; left: 0; right: 0; bottom: 0; top: 90px; background: blue; height: expression(document.body.clientHeight-90);
            }
        </style>
    </head>
    <body>
        <div id="header">
            Test content
        </div>
        <div id="content">
            <iframe width="100%" height="100%" src="startdoc.html" />
        </div>
    </body>
</html>

测试布局
正文,html
{
边距:0;填充:0;高度:100%;溢出:隐藏;
}
#标题
{
位置:绝对;左侧:0;顶部:0;右侧:0;高度:90px;背景:红色;
}
#内容
{
位置:绝对;左侧:0;右侧:0;底部:0;顶部:90px;背景:蓝色;高度:表达式(document.body.clientHeight-90);
}
测试内容

在IE6上以及在我测试过的每一款浏览器上都能正确渲染的额外点数:)

表格伤害了我的眼睛<代码>位置:绝对在这方面被严重低估。请尝试此布局:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Test Layout</title>
        <style type="text/css">
            body, html
            {
                margin: 0; padding: 0; height: 100%; overflow: hidden;
            }
            #header
            {
                position:absolute; left: 0; top: 0; right: 0; height: 90px; background: red;
            }
            #content
            {
                position:absolute; left: 0; right: 0; bottom: 0; top: 90px; background: blue; height: expression(document.body.clientHeight-90);
            }
        </style>
    </head>
    <body>
        <div id="header">
            Test content
        </div>
        <div id="content">
            <iframe width="100%" height="100%" src="startdoc.html" />
        </div>
    </body>
</html>

测试布局
正文,html
{
边距:0;填充:0;高度:100%;溢出:隐藏;
}
#标题
{
位置:绝对;左侧:0;顶部:0;右侧:0;高度:90px;背景:红色;
}
#内容
{
位置:绝对;左侧:0;右侧:0;底部:0;顶部:90px;背景:蓝色;高度:表达式(document.body.clientHeight-90);
}
测试内容

在IE6和我测试过的每一款浏览器上都能正确渲染的额外点数:)

使标题绝对定位,因此它覆盖在iframe上,如下所示:

<table>
<tr style="position:absolute;top:5px">
    <td class="header2">
    asdasdasdasd
    </td>
</tr>
<tr>
    <td class="content2">
        <iframe src="http://www.yahoo.com" scrolling="auto" frameborder="1" />
    </td>
</tr>
</table>​​​

asdasdasd
​​​

使标题绝对定位,使其覆盖在iframe上,如下所示:

<table>
<tr style="position:absolute;top:5px">
    <td class="header2">
    asdasdasdasd
    </td>
</tr>
<tr>
    <td class="content2">
        <iframe src="http://www.yahoo.com" scrolling="auto" frameborder="1" />
    </td>
</tr>
</table>​​​

asdasdasd
​​​

代码不错,但在旧IE(IE7)中不起作用。需要一些支持大多数浏览器的代码。我一路回到IE6都没有问题。我将在一分钟内发布完整的示例,现在就开始编写。好的,我必须回顾一下我们的一个旧项目源代码…现在已修复。我撒了谎——如果你能发现的话,那里有一个IE黑客,但它是微创的:)当然,你也可以使用一个。我们使用它是因为我们希望整个页面包含在一个文件中,这样我们可以更好地处理区域之间的交互,并且我们的布局有更多的区域(页脚、侧栏等)。代码不错,但在旧IE(IE7)中不起作用。需要一些支持大多数浏览器的代码。我一路回到IE6都没有问题。我将在一分钟内发布完整的示例,现在就开始编写。好的,我必须回顾一下我们的一个旧项目源代码…现在已修复。我撒了谎——如果你能发现的话,那里有一个IE黑客,但它是微创的:)当然,你也可以使用一个。我们使用它是因为我们希望整个页面包含在一个文件中,这样我们就可以更好地处理区域之间的交互,并且我们的布局有更多的区域(页脚、侧栏等)。