层固定在右下角

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  2. <html xmlns="http://www.w3.org/1999/xhtml">  
  3. <head>  
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
  5. <title>IE6 position:fixed</title>  
  6. <style type="text/css">  
  7. * { margin:0; padding:0;}   
  8. #content{ height:2000px; }   
  9. #a{ position:fixed; bottom:0; right:0; width:200px; height:60px; background:#F00;}   
  10. /*IE6 fixed bug*/   
  11. * html{overflow:hidden;}   
  12. * html body{height:100%;overflow:auto;}   
  13. * html #a{position:absolute;right:18px;}   
  14. </style>  
  15. </head>  
  16. <body>  
  17. <div id="content">  
  18. IE6 position:fixed   
  19. </div>  
  20. <div id="a">IE6 position:fixed</div>  
  21. </body>  
  22. </html>  
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"   
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  3. <html xmlns="http://www.w3.org/1999/xhtml">  
  4. <head>  
  5. <title>层固定</title>  
  6. <style>  
  7. *{margin:0;padding:0;}   
  8. html {position:relative;width:100%;height:100%;overflow:hidden;}   
  9. body{height:100%;width:100%;background:#EFEFEF;height:100%;overflow:auto;}   
  10. #a{width:300px;height:100px;background:red;position:fixed;right:20px;bottom:0px;}   
  11. </style>  
  12. <script>  
  13. var isie6 = window.XMLHttpRequest?false:true;   
  14. window.onload = function(){   
  15.     var a = document.getElementById('a');   
  16.     var d = document.getElementById('d');   
  17.     if(isie6){   
  18.         a.style.position = 'absolute';   
  19.         window.onscroll = function(){   
  20.             d.innerHTML = '111';   
  21.         }   
  22.     }   
  23. }   
  24. </script>  
  25. </head>  
  26. <body>  
  27. <div id ="d" style="display:none;">11</div>  
  28. <div id='a'>test</div>  
  29. <p>start</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>--</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>--</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>--</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>--</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>--</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>--</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>--</p><p>end</p>  
  30. </body>  
  31. </html>  
  1. da shang
    donate-alipay
               donate-weixin weixinpay

发表评论↓↓