steve Kim steve Kim - 1 year ago 78
jQuery Question

How to position an element relative to the screen (viewport)?

So, I have a button that is located at the bottom right corner of a page as shown in the picture ("current"):

enter image description here

The set up is pretty simple:

<div class="content">
<div class="button" style="position:absolute;right:0px;bottom:0px;">

Now, is there a way to locate the button at the bottom of "visible" screen and not necessary at the bottom of the content as shown on "need" picture?


Answer Source

I believe you are looking for position: fixed.

    position: fixed;
    bottom: 5px;
    right: 5px;