要实现的是head foot固定,中间区域随内容高度自适应,拖动滚动条时foot永远居底。
SolarDreamStudios的方案给了我一个很好的思路,但关键部分是原创的,一直以为会比SolarDreamStudios的方案好,结果仔细看他们的代码,才发现其实原理都差不多,不过他们似乎在兼容性上下了更多工夫,具体未测试。
A. 宽度100%自适应
结构代码
| 代码如下 | 复制代码 |
head foot |
|
表现代码
| 代码如下 | 复制代码 |
| #head { width:100%; text-align:center; background:#FF9400; height:100px; position:absolute; top:0;} #head_height { height:100px;} #middle { margin:20px;} #foot { width:100%; text-align:center; background:#f00; height:100px; position:absolute; bottom:0;} * html #foot { bottom:-1px;} #foot_height { height:100px;} |
|
B. 宽度固定居中
结构代码
| 代码如下 | 复制代码 |
head foot |
|
表现代码
| 代码如下 | 复制代码 |
| #head { width:100%; text-align:center; position:absolute; top:0; left:0;} #head_content { line-height:100px; width:700px; margin:0 auto; background:#FF9400; height:100px;} #head_height { height:100px;} #middle { margin:20px;} #foot { width:100%; text-align:center; position:absolute; bottom:0;} * html #foot { bottom:-1px;} #foot_content { line-height:100px; width:700px; margin:0 auto; background:#f00; height:100px;} #foot_height { height:100px;} |
|
测试环境IE6.0和FF1.5,IE环境下因为BUG有时会自动出现滚动条(SolarDreamStudios的方案一样),FF下为完美效果。
生存战争汉化版
生存战争游戏采用了像素模拟战争游戏,具备了清晰的像素角色人物
超级驾驶2024最新版
你有过在手机也体验真实现场驾驶汽车的想法吗?在超级驾驶就能帮
打造世界正式版免费版
打造世界手机版是一款非常好玩的模拟类手游,在这款游戏中,你可
奇妙汉堡店手游
奇妙汉堡店手游是一个全新的餐厅模拟经营类型的休闲小游戏,整个
辐射避难所online官方版
辐射避难所online手游,非常好玩的模拟闯关手游,一场恐怖