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 colour overlay on image issue

So i've been having a lot of issues with this all day i seem to be struggling with the text within the container. It's not centering here is the code.

codepen

2 Answers

You need to give your textblock´ class atext-align: center` property.

text-align: center;

This will align your text in the center. If it doesn't appear perfectly centered, it might be because your content div is wider than the image.

You may remove the text-align: center line on your .overlay:hover .textblock { selector. You don't need it.

Codepen

Also, I hope you read my reply to your whitespace issue that you posted about earlier. I did put quite some effort in explaining it all in detail :)

Sorry for not replying before mate was reading but i haven't done any html & css for a while so i've forgot a bit need to get back into the swing of things again but your advice was helpful :)

We're you wanting something like this?

Codepen

Sort off but the text isn't disappearing you see