: How to optimize image in Google search if it is a background? I have many images, and for a pretty view and better css control I mark them up as <div style="background:url('image-url')
I have many images, and for a pretty view and better css control I mark them up as
<div style="background:url('image-url') no-repeat center center transparent;
overflow:hidden; display:inline-block; width:150px; height:150px;"></div>
But as we know HTML allows adding alt to image tags for search optimization. How can I include "alt text" in a background situation? I have submitted an image sitemap to Google, which includes all these image's URLs and page URLs.
More posts by @Reiling115
4 Comments
Sorted by latest first Latest Oldest Best
There may be other considerations I'm not aware of, but if you're doing what I think with this method, you might consider using the CSS clip property to get the effect instead. It lets you create the same sort of "window" onto the image, but is done directly on the image itself rather than using a div to cut it off. The result is you'd be using plain img tags in your markup, and can just place alt text on them as usual.
Use image site maps
It is really not recommended to use images this way. It's like using <span> instead of <a>. It is possible to do everything you want with normal <img> tags.
My recommendation: use <img>. If you for some reason really cannot do it, make good image site maps and use really descriptive images names.
I want to add to Roman answer that beside the imag name you can add text to the div or in any part near the imag to help the search engines understand it.
Div tags can get titles to-and help users and search engines to understand the div content.
For that images use descriptive names: use descriptive-name.jpg instead of image-01.jpg. It will help and compensate the absence of alt.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.