<!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>position:fixed——IE条件注释解决方案</title> <style type="text/css"> <!-- body {margin: 0; padding:0} p{ height:50px} .fixed {padding: 10px; background: #000; left: 0px; color: #fff; position: fixed; top:0; } --> </style> <!--[if IE 6]> <style type="text/css">*/ html{overflow:hidden;} body{height:100%;overflow:auto;} .fixed{position:absolute;} </style> <![endif]--> <!--[if lt IE 6]> <style type="text/css"> .fixed{position:absolute;top:expression(eval(document.body.scrollTop + 50));} </style> <![endif]--> </head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> </head> <body> <div class=fixed>position: fixed;我始终在屏幕左上角哦</div> <div> <P>这是为了增加高度</P> <P>这是为了增加高度</P> <P>这是为了增加高度</P> <P>这是为了增加高度</P> <P>这是为了增加高度</P> <P>这是为了增加高度</P> <P>这是为了增加高度</P> <P>这是为了增加高度</P> <P>这是为了增加高度</P> <P>这是为了增加高度</P> <P>这是为了增加高度</P> <P>这是为了增加高度</P> <P>这是为了增加高度</P> <P>这是为了增加高度</P> <P>这是为了增加高度</P> <P>这是为了增加高度</P></div> </body> </html>