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

Joe Consterdine
Joe Consterdine
13,965 Points

Can't get overlay above image?

Hey guys,

I need to add an overlay when I have over my image.

I need to do this WITHOUT a background-image. I know it's easier to do it that way but I need to be able to do it with a regular image tag.

Why in this example does Z-index not work?

And if something could get a working example of when you hover over the image the image opacity lowers with the text remaining visible on top so you can see it clearly!

Much appreciated guys!

Joe

Jesus Mendoza
Jesus Mendoza
23,289 Points

Hey Joe I made this pen long time ago and I think it might help you http://codepen.io/Jesusz0r/pen/ZGzBLO

2 Answers

Joe Consterdine
Joe Consterdine
13,965 Points

Hi Jesus,

that's awesome! Is CSS3 the only way to do it?

Btw, how long you been coding? I think you helped me out last time so thanks a lot!

Jesus Mendoza
Jesus Mendoza
23,289 Points

Do you want to do it with jQuery? I've been coding for almost a year now but I always get distracted so I forget things and gotta learn them again xD

Joe Consterdine
Joe Consterdine
13,965 Points

Only a year? That's impressive man.

I've been learning about 14 months now so you must be learning a lot because I spend everyday on here!

And no...css is fine haha :)