Mobile app version of vmapp.org
Login or Join
Reiling115

: 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')

@Reiling115

Posted in: #BackgroundImage #Seo

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.

10.04% popularity Vote Up Vote Down


Login to follow query

More posts by @Reiling115

4 Comments

Sorted by latest first Latest Oldest Best

 

@Kevin317

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.

10% popularity Vote Up Vote Down


 

@Speyer207

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.

10% popularity Vote Up Vote Down


 

@Murphy175

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.

10% popularity Vote Up Vote Down


 

@Miguel251

For that images use descriptive names: use descriptive-name.jpg instead of image-01.jpg. It will help and compensate the absence of alt.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme