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

General Discussion

SEO Strategy Query

Okay, so I just learned how to use CSS to post images in the background, like it's the latest and coolest thing to do. But my understanding of SEO strategy that it is always better to use the "img" html tag mostly because it gives you the chance to use the "alt" tag to present spider-friendly text. Is there any reason why using the background CSS strategy might be better as far as SEO strategy is concerned?

2 Answers

Joshua Vaage
Joshua Vaage
5,068 Points

I think a good general question to consider is this: How does the document in which the image lies, look without CSS?

Good practice might be to consider whether our pages are communicating their core messages in the HTML alone. Will any part of the message be lost if it is stored in an image? Can any "stored" image contain data which helps to explain it's meaning?

Joshua, I'm not discussing not using CSS, but SEO impacts due to choosing to display images from the CSS file and not an image file.

Matt Campbell
Matt Campbell
9,767 Points

Google won't look at the background image as it's not part of the DOM. If you're using a background image, you're doing so for a reason. It looks better so don't worry about it. Images and SEO aren't a dealbreaker anyway. Make sure that your content is well written with relevant organic keywords and you'll be fine.

So your view is not to worry about SEO. I was thinking that all standard images that don't need to be clickable in a theme/template should utilize the CSS background method while unique images should use the HTML method.