简单的html布局

时间:2013-08-02 19:40:03

标签: html iframe

我猜我需要简单的事情。但我无法找到或弄清楚如何做到这一点。看起来很简单,但也许不是。

我需要带有标题的html页面,左侧和页脚的1个侧边栏。现在是棘手的部分。我注意内容正确的侧边栏是流动的。在那个区域,我需要放置iframe。页面不应该有任何滚动条,因此只有滚动条将是iframe中的滚动条。我有问题,这个区域总是在标题的高度下移动到屏幕的下边缘。这是因为我使用高度100%,但我不知道任何其他方法。如果有办法做高度:100%-120px这不会有问题。

1 个答案:

答案 0 :(得分:1)

检查此演示:Demo

HTML代码

<header>
  Header
</header>
<nav>
  Nav
</nav>
<div>
  <iframe src='http://sasidhar.com' width='100%' frameborder='0' height ='100%'>
</div>

CSS代码

* { padding : 0; margin : 0; }
header {
  position absolute;
  top : 0;
  height : 50px;
  background-color : #ccc;
}
nav {
  position : absolute;
  width : 200px;
  top : 50px;
  bottom : 0;
  background-color : #ece;
}
div {
  position : absolute;
  left : 200px;
  top : 50px;
  bottom : 0;
  right : 0;
  background-color : #cee;
  overflow : hidden;
}

这有用吗?让我知道。