Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Do I need to use position: relative on everything in this situation?

I have a div with a background image, position: absolute.

I have a paragraph that needs to be after this div.

The paragraph is behind the div at the top of the page. Do I need to do something like:

position: relative;
top: 1000px;

To drop it into place?

1 Answer

Steven Parker
Steven Parker
231,261 Points

The best remedy would depend on the relationship between the div and paragraph, and possibly surrounding elements, as well as the reason for setting the position on the div to begin with. For a complete analysis and specific answer, you can show your code.

But some possibilities would include:

  • putting a top margin on the paragraph
  • putting both the div and paragraph into a container and position it instead
  • also positioning the paragraph, and setting appropriate offsets for placement