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

Mark Christiansen
7,622 Points2 Issues with image and overlay, regarding size and height
I have 2 issues with my overlay.
My image is very large (followed along on my own project), and the image is bigger than the height of my screen when it's in the lightbox. Should i resize the image itself before uploading or try with css?
My overlay is set to height and width 100%, but when i scroll down, the overlay only cover the original position of the screen, meaning it scrolls away when I scroll down. What can be the issue here?
my css:
´´´
overlay {
background: rgba(0,0,0,0.8);
width:100%;
height:100%;
position:absolute;
top:0;
left:0;
display: none;
text-align: center;
}
overlay img {
margin-top: 10%;
}
overlay p {
color: black;
}
´´´
Any ideas?
1 Answer

Ryan Field
Courses Plus Student 21,242 Points1) In general, it's always a better practice to load smaller thumbnail images, and then load the larger images when clicked on (via AJAX, etc.) to display in your lightbox. It's not too bad if you only have a few images, but with many images, it can really slow down the load time of your page.
2) position: absolute;
means that the element will be positioned, in your case, at the top left and will stay there if scrolled. To make it so that it's positioned there regardless of scrolling, you'll want to use position: fixed;
. This will 'fix' it in place.
Mark Christiansen
7,622 PointsMark Christiansen
7,622 PointsThanks for clearing it up regarding the thumbnails.
I saw a similar post with position:fixed and I should have tried that first.
Thank you Ryan