0

AIOSEO site health states this image has no alt text tag. How do I fix it and save the change so it solves the issue? Thanks

<div class="_9VmET" style="background-image: url(&quot;https://snw.202.myftpupload.com/wp-content/uploads/2022/12/cropped-Monstro-Video-Camera-8K-150x150.png&quot;);"></div>

Tried adding alt="camera" to div class but change doesn't save after adding change. What am I doing incorrect?

ViRuSTriNiTy
  • 5,017
  • 2
  • 32
  • 58
  • `alt` is an _attribute_, not a tag. Please see [ask], then revise your post title to ask a clear, specific question. Also take the tour so you know how to use this site. – isherwood Apr 11 '23 at 16:05
  • 1
    If it's an image that conveys information not already duplicated in the text then it shouldn't be a background image (but `alt="camera"` is very unlikely to be [*good* alt text](https://jkorpela.fi/html/alt.html)). If it is a decorative background image then it shouldn't need alt text. – Quentin Apr 11 '23 at 16:08
  • are you sure you are not using that image in another place as an `img` tag? – Cornel Raiu Apr 11 '23 at 16:08
  • The right solution depends on context. You might revise to add more markup so we can see how this element is presented. – isherwood Apr 11 '23 at 16:39

1 Answers1

1

Divs don't have alt attributes. If the goal is to make this element accessible for the visually impaired, you have a number of options.

You could also implement an actual image element with an alt attribute and set sizing to cover the div completely so that the layout outcome is the same. See How can I fill a div with an image while keeping it proportional?.

isherwood
  • 58,414
  • 16
  • 114
  • 157