Search code examples
csspositionfixed

fixed bottom right but left top will be in the same axis


I want to make a div which is fixed on the bottom and right but top margin and left margin will always be 100px from the browser! It is very weird I know but I coulndt do it. Maybe it needs a javascript? or can I make it with css?


Solution

  • Here is a solution, just set left and top to the margin you need.

    jsFiddle

    JS

    <div class="fixed"></div>
    

    CSS

    .fixed {
        position:fixed;
        left:100px;
        top:100px;
        right:0;
        bottom:0;
        background-color:#F00;
    }