Search code examples
csspositioning

In css, how do I make things stay positioned in a way that nothing will push it on the page


So, I tried doing position:absolute, but whenever I place something new, (eg a div) the other div gets pushed down.

Eg. without other div

Box

With other div

other div

box

Thanks :D


Solution

  • Are you sure the CSS rule is not ovewritten? (Check this with a browser code inspector, such as Firefox's Firebug or Opera's Dragonfly) Additionally, If you want the div to be put on a place despite srolling, use

    position: fixed

    instead. This will keep your object on a fixed place in the page.