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 CSS Layout Basics Positioning Page Content Create an Image Caption with Absolute Positioning

Positioning elements

In this video, the caption is positioned over the image with absolute positioning relative to the container holding the image. I'm confused as to why the container is given relative positioning rather than the image itself. Won't this cause issues if the container or image change size?

1 Answer

Steven Parker
Steven Parker
229,644 Points

The container is given a "relative" position setting, but no placement offsets are used. So the position of the container does not change, but the setting causes it to become the reference for any positioned child elements (instead of the window).