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!

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

HTML Introduction to HTML and CSS Make It Beautiful With CSS Select and Style by Element

Question about image URL in CSS

I should have asked this earlier. Why are the image urls for Twitter, etc in the CSS file? Doesn't that keep screen readers and search engines from accessing them?

2 Answers

Gergely Bocz
Gergely Bocz
14,244 Points

Hi Theodore Blanner!

You are right, that if you want an image to be accessible to screen readers and want to optimize for SEO, then you should put it inside your HTML with the appropriate alt attribute.

However, if it's only for the looks and the image itself is not part of your content -or the image itself is not even yours-, then there is no point optimizing it for search engines, since SEO only cares about the original content you have.

I hope it answers your question.

Regards, GergΕ‘

Hey, thanks for the quick response! I don't understand much about how screen readers work at this point so I'd like to understand this: If an image is a link to a social media account, should I put the image in html as opposed to a CSS file? That's pretty much the only thing that made me curious. Thanks again, man!

Gergely Bocz
Gergely Bocz
14,244 Points

I don't know much about SEO, so I can't say for certain. But as far as I know, SEO is basically about 2 things: One is original content and the other is linking from other well known and trusted sites -like social media. Since social media images are neither original nor a link to your site from another site, they don't fall into either category. Therefore I think you don't have to care about them.

What I learned for SEO specifically as a frond end dev., is that I should always use semantic HTML which in itself describes the purpose of the content pretty well. SEO likes that. Also, read a bit about meta tags and what they do if you are interested in having good SEO basics for a website.

Other than that I wouldn't really care about SEO for the most part. Have a nice website, that people like visiting and the traffic and cross-linking will help the site improve SEO-wise on its own.