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

JavaScript jQuery Basics (2014) Creating a Simple Lightbox Perform: Part 3

Hazel Parreno
Hazel Parreno
18,646 Points

CSS position for overlay

I don't understand why we set the rule for top:0 and left:0 for the overlay (which would position it at the top left) and then have another rule to center it through text-align?

2 Answers

Lee Nolan
Lee Nolan
21,690 Points

Hi, I think the top:0 and left:0 is to position the entire overlay, as in the transparent black box that covers the whole screen, whereas the text-align: centre is to position the content inside the overlay, i.e. the image.

Hazel Parreno
Hazel Parreno
18,646 Points

Thanks ! I get it now.