---
title: "在ie下实现position:fixed效果最简单有效的途径"
author: "i_love_sc"
date: "2008-02-20T17:31:27Z"
tags: []
slug: "ie-position-fixed"
draft: false
lastmod: "2008-02-20T17:31:27Z"
id: 163697
url: "https://hiyoungjay.iteye.com/blog/163697"
---

有个限制，一定要设置一下DOCTYPE

```HTML
  
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

```


给需要fixed的元素加个类名class='fixed'
普通的style里面
div.fixed {
   position; fixed
}
给支持fixed的浏览器
然后加上

```HTML
  
<!--[if lte ie 6]>
<style type="text/css">
html, body
	{
	height: 100%;
	overflow: auto;
	}
div.fixed {
	position: absolute;
}
</style>
<![endif]-->

```