Created: Last updated:
I've just discovered a little style problem with the Facebook Like button. Somewhere within all the elements is a div that holds the iFrame element. This div element has an inline style "top: -2000px".
This is clearly not good, i.e. how you should hide an element with an offset!
You can easily hide an element from view with offset. Lets see what they did in Facebook
<div style="position: absolute; top: -2000px; ">
The position attribute takes the element out of the current flow. The negative value from the top attribute positions the element 2000px above its current place; which is relative to the parent usually defined with a "position: relative" style.
Left versus top
Now here's why this is not a good thing.
If such a element on your page is somewhere below the 2000px range the element suddenly becomes visible again in your webpage.
A better solution is to move an element to the left. There is usually no way you can scroll ever to the left. With a style like "left: -2000px" an element will be always out of site.