Posted By

marcio on 01/25/10


Tagged

css ie expressions position


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

jillella


Position fixed crossbrowser


 / Published in: CSS
 

URL: http://www.howtocreate.co.uk/fixedPosition.html

  1. <style type="text/css">
  2. body > div#fixme {
  3. position: fixed; left: 20px; top: 10px;
  4. }
  5. </style>
  6. <!--[if lt IE 7]>
  7. <style type="text/css">
  8. div#fixme {
  9. left: expression( ( 20 + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
  10. top: expression( ( 10 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
  11. }
  12. </style>
  13. <![endif]-->
  14.  
  15.  
  16. <!-- Si queremos posicionarlo utilizando right y bottom: -->
  17. <style type="text/css">
  18. body > div#fixme {
  19. position: fixed; right: 20px; bottom: 10px;
  20. }
  21. </style>
  22. <!--[if lt IE 7]>
  23. <style type="text/css">
  24. div#fixme {
  25. right: auto; bottom: auto;
  26. left: expression( ( -20 - fixme.offsetWidth + ( document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth ) + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
  27. top: expression( ( -10 - fixme.offsetHeight + ( document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
  28. }
  29. </style>
  30. <![endif]-->

Report this snippet  

You need to login to post a comment.