---
title: "div固定位置，不随滚动条滚动"
author: "doPPP"
date: "2013-01-29T09:13:44Z"
tags: []
categories: ["Web前端"]
slug: "div"
draft: false
lastmod: "2013-01-29T09:13:44Z"
id: 1777150
url: "https://doppp.iteye.com/blog/1777150"
---

```
<html>
<head>
    <title>div固定位置，不随滚动条滚动</title>
    <style type="text/css">
        html,body {
            overflow:hidden;
            margin:0px;
            width:100%;
            height:100%;
        }
        .virtual_body {
            width:100%;
            height:100%;
            overflow-y:scroll;
            overflow-x:auto;
        }
        .fixed_div {
            position:absolute;
            z-index:2008;
            bottom:20px;
            left:40px;
            width:800px;
            height:40px;
            border:1px solid red;
            background:#e5e5e5;
        }
    </style>
</head>
<body>
<div class="fixed_div">我永远在这里，哪也不去</div>
<div class="virtual_body">
    <div style="height:888px;">
    	<br/><br/><br/><br/><br/><br/><br/><br/><br/>
        滚动条是把杀猪刀
    </div>
</div>
</body>
</html>
```