div固定顶部和底部

<!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"/>
    <title>div固定</title>
    <style type="text/css">
    /*index.html footer*/
    body #index_footer {
        z-index: 999;
        position: fixed;
        _position: absolute;/*兼容IE6*/
        _top: expression(offsetParent.scrollTop+document.documentElement.clientHeight-this.offsetHeight);/*兼容IE6*/
        bottom: 0px;
        padding: 0px 0px 10px;
        background-color: #eeeeaa;
        border-top:4px solid #e2e2e2;
        width: 100%;
    }

    /*index.html 成功添加*/
    body #index_head {
        z-index: 999;
        position: fixed;
        _position:absolute;/*兼容IE6*/
        _top:expression(eval(document.documentElement.scrollTop));/*兼容IE6*/
        width: 100%;
        text-align: center;
    }
    body #index_successHint {
        background-color: #ef0000;
        width: 160px;
        line-height: 30px;
        border-radius: 8px;
        margin:0 auto;
    }

    .index_footer_Button {
        padding: 27px 0px;
        background-color: #AAA;
        cursor: pointer;
    }
    </style>
</head>
<body>
<div id="index_head">
    <div id="index_successHint">
        <span style="margin-left: 5px;">成功添加</span>
    </div>
</div>
<div id="index_footer">
    <div style="float: right;width: 60px;text-align: center;color: #ffffff;">
        <div class="index_footer_Button" id="addBtn" style="margin-bottom: 5px;">添加</div>
        <div class="index_footer_Button" id="cancelBtn">取消</div>
    </div>
</div>
</body>
</html>
时间: 2024-08-29 12:34:17

div固定顶部和底部的相关文章

CSS如何控制div固定于网页底部

CSS如何控制div固定于网页底部: 网页设计中可能需要这样的效果,那就是将一个条幅放在网页的最底部,并且在网页滚动的时候能够穿过此条幅. 代码实例如下: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="author" content="http://www.51texiao.cn/" /> <tit

Android界面,固定顶部、底部导航。中间可滑动

<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="match_parent" android:layout_width="match_parent" android:b

jquery实现平滑滚动到顶部、底部、或者指定位置(个人随笔)

个人随笔,欢迎指教. 代码如下: <!doctype html> <html> <head> <meta charset="utf-8"> <title>jquery实现平滑滚动到顶部.底部.或者指定地方</title> <script type="text/javascript" src="JavaScript/jquery-1.11.2.min.js"><

实现移动端顶部与底部固定,内容区优化的效果

实现顶部与底部固定的效果十分容易,且很多人都会选择用这个方式,就是顶部position:fixed,底部也position:fixed.实现的效果就像下面两张图,container区域是布满整个屏幕的,且滚动条也是滚动在整个屏幕中,调内容区时只能调节高度.    其实还有一种方式可以实现较好的效果,就是内容区只在顶部和底部的中间,内容部分和滚动条也只是中间区域滚动 实现代码: <meta name="viewport" content="width=device-wid

jQuery&amp;CSS 顶部和底部固定浮动工具栏 兼容IE6

现在常常能看到一些网站(如:新浪微博和花瓣)导航条或工具栏固定在网页的顶部或其他地方.这样的布局方式,能便于用户点击和“曝光率”,不用每次都要把网页拖动到某个特定位置才能点击或看到. 其实这样的布局方式很早就有,只是没有那么个契机推广开吧.做起来也不复杂,只要设置一个小小的属性“position:fixed”便能完成,最关键的无不呼在于要兼容IE6而已. 首先我们来看HTML代码,是不是超简单?这里提供的只是一个简单的框架,实际应用的时候,只要把想要的元素添加东西就在这区域内加就行. HTML

内容高度小于窗口高度时版权div固定在底部

<!doctype html><html><head><meta charset="utf-8"><title>文档内容高度小于窗口高度时底部版权始终在底部-懒人建站</title><meta name="description" content="网站建设中经常遇到文档内容高度小于窗口高度时底部版权始终在底部的问题,纯css不太好解决这个问题,这里使用js代码来对检测文档高度和

返回顶部的功能 div固定在页面位置不变

1.你在网上搜索的时候,可能会搜索到div固定在页面上,不随滚动条滚动而滚动是用CSS写的,写法是position:fixed;bottom:0; 但是这个在iframe满地跑的页面实际开发中,有啥用呢?反正我用了感觉没啥用. 2.还有一种就是JS控制了.我写的是随着滚动滚动 ,计算div的绝对与可视页面的位置不变. $(window.parent).on('scroll',function(){ $(返回顶部所在div选择器).css('top',parent.document.documen

html css div固定底部

<div id="father"> <footer></footer> </div> #father{ position:relative; //父元素加入相对定位  不加则固定到html底部 } footer { position: absolute; //绝对定位 bottom: 0; left: 50%; //水平居中 transform: translate(-50%, 0%); //调整位置 } 原文地址:https://www

将div固定在页面某处 兼容ie6

一.样式: ? 1 2 3 4 5 6 7 8 <style> body,div{ margin:0; padding:0} .wrap{width:1000px; margin:0 auto} .info{width:1000px; height:40px;background:#f2f2f2; text-align:center; font:normal 14px/40px 'Microsoft YaHei'; color:#333} *html{background-image:url(