Moz Q&A is closed.
After more than 13 years, and tens of thousands of questions, Moz Q&A closed on 12th December 2024. Whilst we’re not completely removing the content - many posts will still be possible to view - we have locked both new posts and new replies. More details here.
Background Images and ALT text
-
We pretty much exclusively use background images for our sites. How do I add in alt text? I tried a Google search for this issue and the best answer I could find was "Use the 'title' tag in the containing div", but that was from 2010.
Is there a better way to do it? And no, we're not going to switch to using standard images, because background images are way more slick for UX.
-
Does it has any positive effect on ranking? (seo)
-
You can't use ALT text to background images.
If your images are loaded as img tag then you have title, alt. Example:
But background images isn't regular images loaded with img tag. They can be loaded only with CSS styling. And therefore they doesn't comes with title and alt. Example:
As you can see you can't use title or alt for image there. Only way is to define title as this:
or better this one:
I know that isn't 100% background but also helps.Alternative way can be ARIA. If you love background images but really wish alt text you can use WAI-ARIA and define them as:
...
But GoogleBot doesn't support aria-label for now. -
Yes for screen readers and using it as alt and title for your images that are there. So you are not trying to trick Google, you are trying to figure out a way to mark what is actually there. For google image search, I have had success ranking images even if used as backgrounds in divs by naming them with what I was trying to rank them for. Since I could not use alt or title I named images with my target in them. These images were all for a brand query.
Example: image on mybrand.com named mybrand-imageName.png
we were able to get most of those images to show up when doing an image search for mybrand
-
I'm going with "Google is too smart for that" on the transparent image alt text front. I guess it would help out people using a screen reader, but I'd like to get some of the images into Google image search. It seems like alt text is pretty much required to rank for that?
-
I think that adding title to the div is the only way for you to do a background image in CSS.
You can cheat a little by then loading a transparent image in the container that the background image is in, make this transparent image have an alt tag and title tag for whatever your background image is about.
If you are doing this for seo purposes this should work, if you are doing it to have the html well formatted, there is only the div tag.
Cheers!
-Erick
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Logo Image H1 Tag SquareSpace
We have a site hosted on SquareSpace: Roomhance.com Going through the on-page optimizaton tool, we noticed that the H1 tags weren't fully optimized. If you click on view source on the page, it shows 2 H1 tags on the home page: id="logoImage"><a <span="" class="html-attribute-name">href</a><a <span="" class="html-attribute-name">="</a>/">src="//static1.squarespace.com/static/5bcca055ab1a62465f5b9ee7/t/5c18feb270a6adf771765799/1588613682225/?format=1500w" alt="Virtual Staging For Real Estate | Roomhance" /> style="text-align:center;white-space:pre-wrap;">Virtual Staging The 2nd one shown above it the H1 tag we want. I'm wondering if the H1 tag in the logo image is hurting us for SEO? Can't figure out how to modify it in SquareSpace.
On-Page Optimization | | vikasnwu0 -
Text that appears when hovering over navigation tabs
Hi, I have a Wordpress website and want to delete or edit the text that appears when I hover over my navigation tabs. In my case, the text is always the same as the page title, but I don't know where to edit it separately. When I change the title of a page that is in the navigation, the text that appears changes too. So the general setting is that this text is the same as the page title. Does somebody have an idea where to edit this? Thanks!
On-Page Optimization | | Mat_C0 -
Duplicate anchor text vs poor relevance in internal links
We're writing a number of blog posts, all based around a particular head-term (call it "women's widgets"). Each post will be centered around a different long-tail keyword (e.g. "women's brandA widgets", "women's brandB widgets", "women's type1 widgets", etc.). We want to link from the blog posts back to the main "women's widgets" category-level page on our site. Should we: a) Use the words "women's widgets" in each blog post and link that to the "women's widgets" page? This would be the most relevant, but it also seems like using the same anchor text on all of the posts, and linking to the main page, is not good since Google doesn't like seeing the same exact anchor text all the time, right? b) Link the long-tail keyword ("women's brandA widgets") to the main "women's widgets" page? That would solve the anchor text duplication issue, but then the anchor text doesn't seem relevant to the page being linked to (it might never mention "brandA" on that main page at all), and I think it would also hurt the blog post's chances of ranking for the long-tail keyword since we're basically saying that there's a more relevant page for that keyword somewhere else (i.e. you shouldn't link out from a page using the phrase you're trying to optimize that page for). c) Link a nearby word/phrase instead? For example, we could say "Trust Companyname.com for your women's widget needs", and link "Companyname.com" to the "women's widget" page. By proximity to the keyword phrase, that may help a bit, but again the relevancy of the anchor text to the page being linked to is fairly low. I'd hate to have a bunch of "click here", "read this" or "company name" anchor texts being used, just in the name of not overusing the head-term in the anchor text. Are we just missing something, or misunderstanding Google's preferences? What do you do when you don't want to overuse a keyword in anchor text, but you still want to link to a main category-level page using the head-term in order to tell Google that that is the most relevant, best page for that keyword? Is anchor text duplication more of a problem for external backlinks, and less of an issue for internal interlinking? Do you have a different suggestion, other than what I outlined above? Thanks for the help!
On-Page Optimization | | BandLeader
John0 -
Alt text / internal linking
Hi everyone A question about best practice when linking from pictures on our homepage - hirespace.com We have an option of using divs with background images (nicer in terms of design) but it means that we can't use anchor text or alt text to show Google what these internal links are about. The other option is to use images which do not allow us as much flexibility in terms of CSS but would allow us to use alt text. There is also an opinion that we should have separate text links at the bottom of the homepage to get the anchor page in. What is best practice in this situation - is alt text worth sacrificing some CSS flexibility for? How important is anchor/alt text for internal linking? Thanks guys.
On-Page Optimization | | HireSpace0 -
How important are image file names
Hi, How important do you think the image file names are for image search?
On-Page Optimization | | jjtech
I know it used to be the best practice a while ago but is it still important? Thanks in advance, JJ0 -
SEO Location Pages - ALT Image Tag Question
Hello Guru's, I have a Hire Website whereby you can rent products online. I have created different Location pages for these which are in essence the same pages page but with different location specific urls, title tags , on page content etc etc. This helps me to rank for local search. These location pages also display 20 products per page. My question is Should I make the ALT IMAGE TEXT location specific for each of the 20 products . Example - Steam Cleaner Rental in "location" or should I only amend a few of the Atl Image Texts to be location specific. I don't want to come accross as spammy in google eyes but I also don't want to be seen as having duplicate content , images etc etc What do you think ? thanks Sarah.
On-Page Optimization | | SarahCollins0 -
Alt tag using photoshop
Simple question i think. Ive started adding alt tags to images using the slice tool in photoshop. This takes up a menu were the last part of is alt tag: This way to add alt tags does work right? I used SEO-browser afterwards and couldnt see the tag. There are maybe other better ways to see if your tags are in there ? Dan L.
On-Page Optimization | | danlae0 -
Image Optimization - File Name Important?
I am currently working on a site with 100+ recipes that all have image file names that are relevant, but not optimized for keyword purposes. I'm wondering - from an SEO perspective - would it be worth my time to go back through all of the images and rename them with keywords in mind? On my own site I have always done this as a "best practice" but I'm curious - does it make a difference to search engines? Does anyone have any recent research/experiences that they would like to share? Thanks!
On-Page Optimization | | EssEEmily0