Search code examples
htmlcssfacebook-likepositionfixed

Position: Fixed isn't fixed?


I am trying to have my facebook like button stay in the top left corner and as the user scrolls down it follows them... What is wrong with my code? It shows but as I scroll down it does not move with the scroll. Tested locally on both of the latest versions safari and firefox. Please help!

 topleft{
   position: fixed;
   top: 0;
   left: 0;
 }

<top> FACEBOOK "LIKE BUTTON" IFRAME CODE HERE </top>

Solution

  • You aren't selecting your like button properly. You need to add a class attribute for css selection.

    Try something like

    <div class="facebook">FACEBOOK IFRAME</div>
    

    Notice the ".facebook" rather than just "facebook".

    .facebook {
       position: fixed;
       top: 0;
       left: 0;
    }