1

I have web app. For images we are using HTML tag img and we are also using alt attribute for SEO purposes.

Now, we are redesigning our website to improve user experience and our designer suggest to replace the img tags with <div style="background-url(image)"> because using this technique images are no resized and so on. However, I see the big disadvantage that using this approach we loose the alt attribute, and this will directly impact in our SEO.

Any suggestions?

unor
  • 92,415
  • 26
  • 211
  • 360
Rober
  • 5,868
  • 17
  • 58
  • 110

2 Answers2

0

Depending on how much control you require over the image would decide this for me. As you can still resize and control HTML img tags through your CSS.

You do have more control over image cropping, positioning, animation effects etc with background images but if the design only requires the image to resize depending on the screen size then you should still be able to achieve this with HTML img tags.

But, if you would like to know more about the pros and cons of both techniques then try reading this useful thread:

When to use IMG vs. CSS background-image?

Community
  • 1
  • 1
JRW
  • 65
  • 1
  • 8
0

You need to look at what is the purpose of the image being used, if it is background image then use background or else image.

What would be worth considering is that a lot of websites give their website title (not talking about the title tag here) in an h1 and then use CSS to hide the text and show a logo image, which also serves the purpose of an alt tag in fact even better because it's wrapped in better markup, like an h1 which gives meaning to the search engine that this is the main header/title (read:brand name) of the website.