我是头
我是主体
有多少内容,我就有多高

 

我是脚

我要随滚动条滚动
我要随滚动条滚动
我要随滚动条滚动
<!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" />
<meta content="IE=EmulateIE7" http-equiv="X-UA-Compatible"><!--据说这个可以只需要兼容IE7-->
<title>无标题文档</title>
<style type="text/css">
*{margin:0; padding:0; border:0;}

#d{
    background:url(images/index_bg.jpg) repeat-y scroll center top transparent;
    left: 50%;
    margin-left: -500px;
    position: relative;
    width: 1000px;
    }

.top,.main,.bottom,.fixed{text-align:center;}

.top{
    background-color:#C30;
    height: 101px;
    padding-top: 4px;
}

.main{
    width:980px;
    margin:20px auto 0;
    background-color:#FC0;
    padding:10px;
}
.main .cont{height:900px;}

.main .cont .contL,.main .cont .contR{
    float:left;
}

.main .cont .contL{
    width:750px;
    background-color:#93C;
    height:900px;
    margin-right:15px;
}

.main .cont .contR{
    width:210px;
    background-color:#33F;
    height:500px;
    }

.bottom{
    background-color:#00F;
    clear: both;
    color: #373737;
    height: 192px;
    margin: 10px auto;
    overflow: hidden;
    padding-top: 20px;
    width: 1000px;
}

.fixed{
    width:190px;
    line-height:40px;
    padding-top:20px;
    padding-bottom:20px;
    background-color:#999;
    position:fixed;
    left:65%;
    top:160px;
    z-index:999;/*为了让DIV永远在最前面,不被其他元素遮住*/
    _position:absolute;/*这里开始的2句代码是为ie6不兼容position:fixed;而写的*/
    _top:expression(eval(document.documentElement.scrollTop+160));/*这里需要获取滚动高度+元素原本的高度*/
}
</style>
</head>

<body>
    <div id="d">
        <div class="top">我是头</div>
        <div class="main">
        我是主体<br />
        有多少内容,我就有多高<br />
        <div class="cont">
            <div class="contL"></div>
            <div class="contR"></div>
        </div>
        </div>
        <div class="bottom">我是脚</div>
    </div>
    <div class="fixed">
    我要随滚动条滚动<br />
    我要随滚动条滚动<br />
    我要随滚动条滚动<br />
    </div>
</body>
</html>

css 兼容 position:fixed的更多相关文章

  1. 小技巧css解决移动端ios不兼容position:fixed属性,无需插件

    移动端开发仿app头部底部固定设置position:fixed,android2.2以上已经实现.但是在ios8以下系统,当小键盘激活时,都会出现位置浮动问题.如图: 如何解决: 查阅资料之后想到一下 ...

  2. 让IE6兼容position:fixed

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  3. css中position:fixed实现div居中

    上下左右 居中 代码如下 复制代码 div{ position:fixed; margin:auto; left:0; right:0; top:0; bottom:0; width:200px; h ...

  4. IOS系统不兼容position: fixed;属性的解决方案

    position: fixed;属性在IOS系统手机上会有很明显的抖动,解决方式: 只需要在中间部分外层div添加css样式position:fixed;top:50px; bottom:50px;o ...

  5. CSS中position:fixed的用法

    我们都知道CSS中定位属性position的值,除了默认的值外,还有absolute,relative和fixed.我平时比较常用absolute和relative,而position:fixed却没 ...

  6. CSS中position:fixed的相关用法

    CSS中的三大重点知识: 1.float,浮动 2.盒子模型 3.position绝对定位 今天主要写下position中fixed相关知识: position:static,relative,abs ...

  7. position:fixed 兼容浏览器低版本

    项目中遇到的坑,写篇博客做个笔记纪念下,position: fixed一般来说都兼容各个浏览器,但是要兼容浏览低版本问题,就得用-webkit-transform: translateZ(0);这段代 ...

  8. 苹果手机对网页上样式为position:fixed的弹窗支持不好的解决办法

    在Web页面上,如果想模拟对话框效果,一般会给div元素添加position:fixed的样式来实现,然后给背景添加一个半透明的遮罩.如: .fixedDiv { position: fixed; t ...

  9. ios position:fixed 上滑下拉抖动

    ios position:fixed 上滑下拉抖动 最近呢遇到一个ios的兼容问题,界面是需要一个头底部的固定的效果,用的position:fixed定位布局,写完测试发现安卓手机正常的,按时ios上 ...

随机推荐

  1. hdoj 1896 Stones【优先队列】

    Stones Time Limit: 5000/3000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Subm ...

  2. sql语句书写升降序

    1, desc:降序,明天今天昨天,zyx...cba,.....321 sql语句:select * from SC_BackDiggingInfo where WriteDate<='201 ...

  3. C++的静态分发(CRTP)和动态分发(虚函数多态)的比较

    虚函数是C++实现多态的工具,在运行时根据虚表决定调用合适的函数.这被称作动态分发.虚函数很好的实现了多态的要求,但是在运行时引入了一些开销,包括: 对每一个虚函数的调用都需要额外的指针寻址 虚函数通 ...

  4. 键盘事件与JS Filter

    今天在写一个JS输入文本过滤的程序,本来我的设想是在keypress事件中获取按下的键,然后再进行判断,这样的话总是出错,最后终于明白自己把事件的发生顺序搞错了,应该是先keydown,然后是keyp ...

  5. STM32的优先级NVIC_PriorityGroupConfig的理解及其使用

    写作原由:因为之前有对stm32 优先级做过研究,但是没时间把整理的东西发表,最近项目需要2个串口,但是不是两个串口同时使用,只是随机使用其中一个,程序对2个串口的优先级需要配置: 此文思路:“中断优 ...

  6. Getting started with new I/O (NIO)--reference

    The new input/output (NIO) library, introduced with JDK 1.4, provides high-speed, block-oriented I/O ...

  7. (转载)为啥我们要学习Linux

    学习Linux也有一阵子了,这过程中磕磕撞撞的,遇到了问题,也解决了一些问题,学习的路子是曲折的,想总结点啥的,让刚刚学习Linux的不会望而生畏. 为啥我们要学习Linux 技术的价值不在于这个技术 ...

  8. hdu2074java

    叠筐 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submissi ...

  9. android注解使用详解(图文)

    在使用Java的SSH框架的时候,一直在感叹注解真是方便啊,关于注解的原理,大家可以参考我的另一片文章Java注解详解.最近有时间研究了android注解的使用,今天与大家分享一下. android中 ...

  10. 卸载RedHat7自带的yum,安装并使用网易163源

    由于redhat的yum在线更新是收费的,如果没有注册的话不能使用,如果要使用,需将redhat的yum卸载后,安装CentOS yum工具,再配置其他源,以下为详细过程: 删除redhat原有的yu ...