davidrac
davidrac

Reputation: 10738

How to push down the entire page with CSS

I'm making a top bar that is dynamically added to existing pages.

When it's loaded, it should push down the content of the entire page and then appear at the top.

The way it pushes down the content of the page is by adding the following CSS rule to the page:

body {padding-top: 50px}

The problem is that there are pages where this rule doesn't work properly. For example, pages with elements with absolute positioning.

Is there a better way to push the content of the page down?

Upvotes: 4

Views: 1977

Answers (1)

Matt Komarnicki
Matt Komarnicki

Reputation: 5422

For body try setting position relative and then set top with some offset amount like 100px. Of course change it to your needs.

Upvotes: 2

Related Questions