How to add alternative text to an object?

If I had an object like this:

<p><object classid="…" height="…" width="…"><param name="…"value="…"/> <param name="…" value="…" /><param name="…" value="…" /> <object data="…" height="…" type="…"><param name="…" value="…" /> <param name="…" value="…" /></object></object></p> 

Where would I place the alt label so that the user sees the text? The object displayed in this code is a video, and I looked online for a solution, but I cannot find a clear answer. (Triple dots just replace the code)

+8
source share
4 answers

Just add alternate text between these tags:

 <object data="img/failedToLoad.png" type="image/png">Alternative Text</object> 
+4
source

According to the definition of object backup content that will be displayed when the object is rendered unsuccessfully is the content of the elements. More precisely, it consists of all child elements of an object , except for param elements. In fact, the fragmentary code in the question contains such fallback content: the internal element of the object is the fallback content for the outside. To get a reserve for return, place it inside the internal element of object ; it can be any content, including text:

  <p><object classid="..." height="..." width="..."><param name="..."value="..."> <param name="..." value="..." /><param name="..." value="..." /> <object data="..." height="..." type="..."><param name="..." value="..." /> <param name="..." value="..." />This is fallback content.</object></object></p> 

Note. If the backup or alternative content means that the text is not displayed when the attachment of the object is successful, that is, a video presentation is displayed.

+1
source

Adding alt to <object> not best practice.

0
source

It looks like you are looking for the title attribute, so the user sees alternative text on hover:

 <object title="hello world" classid="..." height="..." width="..."> 

For accessibility, you can use aria-label or aria-labelledby on <object> s or on the div surrounding each marked object. Additional information .

-2
source

Source: https://habr.com/ru/post/1210834/


All Articles