Solution to position: fixed failure in IE6
<! DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>IE6 position:fixed bug</title> <style> *{padding:0;margin:0} p{height:2000px} #gs{border:1px solid #000;position:fixed;right:30px;top:120px} </style> <!-- [if IE 6]> <style type="text/css"> html{overflow:hidden} body{height:100%;overflow:auto} #gs{position:absolute} </style> <! [endif]--> </head> <body> <div id="rightform"> <p>11111111111111111</p> <input id="gs" name="gs" type="text" value="" /> </div> </body> </html>
/*Common methods other than IE6 browsers*/ .ie6fixedTL{position:fixed;left:0;top:0} .ie6fixedBR{position:fixed;right:0;bottom:0} /*Unique methods of IE6 browser*/ * html .ie6fixedTL{position:absolute;left:expression(eval(document.documentElement.scrollLeft));top:expression(eval(document.documentElement.scrollTop))} * html .ie6fixedBR{position:absolute;left:expression(eval(document.documentElement.scrollLeft+document.documentElement.clientWidth-this.offsetWidth)-(parseInt(this.currentStyle.marginLeft,10)||0)-(parseInt(this.currentStyle.marginRight,10)||0)); top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)))}
/*Common methods other than IE6 browsers*/ .ie6fixedTL{position:fixed;left:10px;top:10px} /*Unique methods of IE6 browser*/ * html .ie6fixedTL{position:absolute;left:expression(eval(document.documentElement.scrollLeft+10));top:expression(eval(document.documentElement.scrollTop+10))}
/*Common methods other than IE6 browsers*/ .ie6fixedTL{position:fixed;left:0;top:0} .ie6fixedBR{position:fixed;right:0;bottom:0} /*Unique methods of IE6 browser*/ /*Fix IE6 vibration bug*/ * html,* html body{background-image:url(about:blank);background-attachment:fixed} * html .ie6fixedTL{position:absolute;left:expression(eval(document.documentElement.scrollLeft));top:expression(eval(document.documentElement.scrollTop))} * html .ie6fixedBR{position:absolute;left:expression(eval(document.documentElement.scrollLeft+document.documentElement.clientWidth-this.offsetWidth)-(parseInt(this.currentStyle.marginLeft,10)||0)-(parseInt(this.currentStyle.marginRight,10)||0)); top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)))}