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

Simon Woodard
Simon Woodard
6,545 Points

content: attr to be applied over image?

I have an image with a title attribute, and I would like to use CSS to create the title attribute as content and then style that content as text hovering over the image it got the attribute from.

My search thus far has proved fruitless, so I'm hoping someone here might know if and how it can be done!

2 Answers

Isaac Asante
Isaac Asante
4,752 Points

From what I know, the title attribute should automatically result in text hovering. So I really don't think you need any tweaking there...

Simon Woodard
Simon Woodard
6,545 Points

Unfortunately Isaac, I'm not after a tool tip. Sorry I may not have been clear enough.

I want text to be over an image like on the main image of my website here; http://simonwoodard.com.au/

However rather than using HTML mark up to create the text, I want to be able to use CSS to extract some of the attributes of the image (alt, title, so forth..) and place them as text over the image.

Isaac Asante
Isaac Asante
4,752 Points

Oh ok. I guess an expert might help you here but I'd recommend using your image as a background image with CSS and putting your text on top of it.