css控制div固定在浏览器底部
2013-07-23 15:23
417 查看
css控制div固定在浏览器底部
注意:此功能仅用于页面高度较小页面。
代码如下:
网上找了个更好的:
当浏览器窗口无限缩小,向右拖动滚动条不会出现空白。
恩,感觉上面的对不是很好,这里网上找了个,挺实用的:
注意:此功能仅用于页面高度较小页面。
代码如下:
<html> <head> <style type="text/css"> body{ margin:0px; } #main{ width:100%; height:50px; position:absolute; top:100%; margin-top:-50px; background:#360; color:white; } </style> </head> <body> <div style="border:1px solid #f00;width:500px;height:1800px"></div> <div id="main">bottom</div> </body> </html>
网上找了个更好的:
当浏览器窗口无限缩小,向右拖动滚动条不会出现空白。
<!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> <meta http-equiv="Content-Type" content="text/html; charset=gbk" /> <title>ie6层固定</title> <style type="text/css"> <!-- .bookbox { background-color: #09C; height: 30px; width: 100%; position: fixed; bottom: 0px; left: auto; right: auto; line-height: 30px; text-align: center; _POSITION: absolute;/*兼容IE6*/ _TOP: expression(offsetParent.scrollTop+document.documentElement.clientHeight-this.offsetHeight);/*兼容IE6*/ } .bookbox a{color: #FFF;} --> </style> </head> <body> <div style="border:1px solid #f00;width:500px;height:2000px;">这个例子是实现层固定在浏览器窗口的最下面,兼容IE6.<br /> <br /> 往下看,看页面的最下面</div> <div class="bookbox">测试测试测试测试测试测试测试测试测试测试测试测试测试测试</div> </body> </html>
恩,感觉上面的对不是很好,这里网上找了个,挺实用的:
<!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> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <style type="text/css"> html, body { height: 100%; overflow-y: auto } body, div, p, ul, ol, li, form, input { padding: 0; margin: 0; } body{ position:relative; background: #fff; } #wp { border:1px solid #00f; height: auto; min-height: 100%; _height: 100%; } #ft { border:1px solid #f00; margin-top: -157px; padding: 50px 0 0; } #sc { border:1px solid #f00; width: 580px; margin: 0 auto; padding-left: 20px; padding-bottom: 157px; } #s { border:1px solid #f00; position: relative; height: 33px; z-index:9 } </style> </head> <body> <div id="wp"> <div id="sc"> <div id="s"></div> </div> </div> <div id="ft"> </div> </body> </html>
相关文章推荐
- CSS+DIV固定底部的漂浮导航条(多浏览器兼容)
- CSS控制DIV层固定在浏览器底部
- js控制固定div和随屏滚动div兼容多浏览器和纯css控制(来自网络)
- CSS控制DIV层固定在浏览器底部
- CSS控制DIV永远固定在页面底部不随滚动而滚动
- CSS控制DIV永远固定在页面底部
- "把一个div标签,给它的属性设置position: fixed;bottom:0;固定在浏览器的最底部。 这个div标签在浏览器上下滚动的时候,会一直保持在屏幕最底部,这一点没有问题。但问题是当浏览
- html css 控制div或者table等固定在指定位置
- CSS固定在网页底部的层div
- div+css固定于浏览器
- Css如何定位网站的footer在固定位置(用DIV+CSS让footer始终在底部)
- 让DIV固定在窗口的底部,不随浏览器滚动
- 用CSS固定DIV层在页面顶部和底部(兼容IE6)
- 固定一个div在浏览器底部
- CSS实现定位DIV固定在网页底部
- 多种浏览器下CSS控制DIV居中的代码
- css 控制div高度自适应浏览器的高度
- 利用CSS实现DIV在浏览器中位置相对固定,而且IE6下滚动不闪
- CSS+DIV固定底部的漂浮导航条
- CSS+jquery 实现滑动下拉框 DIV相对于浏览器固定位置