Can We Use An Alt Attribute With The Video Tag? - Codecademy Forums Trang chủ » Html5 Video Alt Text » Can We Use An Alt Attribute With The Video Tag? - Codecademy Forums Có thể bạn quan tâm Html5 Video Scale To Fit Html5 Video Scale To Fit Div Html5 Video Segment Html5 Video Stretch Aspect Ratio Html5 Video Stretch Css Loading Can we use an alt attribute with the video tag? Frequently Asked Questions HTML FAQ rubyslayer42889 March 14, 2018, 8:13pm 1 Question The text content of video tags seems to behave in the same way as the alternative text for the img tag. For consistency, can we use an alt attribute with the video tag instead? Answer This is a great observation but we can not use the alt attribute within the opening video tag. While this may seem inconsistent, this is actually by design as we might want our video element to contain some fallback options. For example, if the video doesn’t load we might want to display a link to another video that does. As attributes can not contain markup, this scenario would not be possible with alt attributes alone. If this fallback handling gives the developer more control, you might be wondering why the img tag doesn’t follow suit. The answer to this involves backwards-compatibility troubles. 40 Likes FAQ: Learn HTML - Intro to HTML - Videos arcsolver75719 March 31, 2018, 11:49pm 2 "As attributes can not contain markup "… what does this statement means? 23 Likes arcsolver75719 March 31, 2018, 11:54pm 3 " backwards-compatibility troubles" can u elaborate it ? what kind of trouble is this exactly? 10 Likes mtf March 31, 2018, 11:59pm 4 arcsolver75719: "As attributes can not contain markup "… what does this statement means? Attributes may not contain HTML mark up (tags), only printable characters. arcsolver75719: " backwards-compatibility troubles" can u elaborate it ? what kind of trouble is this exactly? The number one trouble would be a browser that does not support HTML5, which is when the VIDEO element was introduced. For a less generalized point of view, study the documentation and other articles relating to this element. 30 Likes mtf April 1, 2018, 12:02am 5 We do have an alternative to alt (alternate text) that works across all browsers, the title attribute is valid on the VIDEO element. <video title="Bruce Lee meets Jackie Chan" ...> 68 Likes arcsolver75719 April 1, 2018, 12:05am 6 rubyslayer42889: For example, if the video doesn’t load we might want to display a link to another video that does. As attributes can not contain markup, this scenario would not be possible with alt attributes alone. but we can still give the external link under alt (alternate text) even though if it can’t contain markup. 1 Like arcsolver75719 April 1, 2018, 12:14am 7 10m We do have an alternative to alt (alternate text) that works across all browsers, the title attribute is validr on the VIDEO element. since i just checked screen readers are not able to read the content using title attribute unlike alt 5 Likes mtf April 1, 2018, 12:33am 8 Screen readers can be set to verbose on title attributes, but usually default to alternate text only so the user isn’t inundated with chatter. title attributes are global, and apply to other elements such as links, language change, page fragments, etc. It’s for this reason they are not turned on by default. 16 Likes wammy212 May 3, 2018, 2:39pm 9 the alt attribute contains only text, so how is it not possible to include that? it shouldnt contain “tags” you say. what can happen if i write, say, < video src= “xyz” controls alt =“video on so-and-so” > and close the element properly, and include the fallback url between them? please explain. 4 Likes mtf May 3, 2018, 5:27pm 10 Go the the W3.org site and look up the VIDEO element. Find the part that describes permitted attributes. That is where you will find your explanation. Part of the reasoning is that ALT text describes a static image, not a changing one. That is what closed captioning is for. 16 Likes beta6078252934 October 11, 2019, 7:46pm 11 But consider a situation where a blind person has used a device that can’t play the video. How will he know there was a video and it isn’t supported? mtf October 11, 2019, 7:55pm 12 Welcome to the forums, @beta6078252934, The video element has a text node where we write the message, Your device does not support video 5 Likes swapnilb007 April 2, 2020, 11:13pm 13 still the concept is not clear. what does the alt tag represents that it can’t be used in a video tag? what if i write <video src =“xyz.mp4” controls alt=“The video is about a grizzly bear”.> why is that wrong? 4 Likes hasib033 April 10, 2020, 1:05pm 14 mtf: We do have an alternative to alt (alternate text) that works across all browsers, the title attribute is valid on the VIDEO element. <video title="Bruce Lee meets Jackie Chan" ...> Thanks for the suggetion. 6 Likes miracleony April 20, 2020, 11:29pm 15 arcsolver75719: but we can still give the external link under alt (alternate text) even though if it can’t contain markup. I hate to bring this back up again, but could you give an example? wispring April 29, 2020, 5:49am 16 You can’t give an external link under alt here at codecademy and have it display automatically. I tried. <img src="https://content.codecademy.com/courses/web-101/web101-image_brownbeat.jpg" alt="https://content.codecademy.com/courses/web-101/web101-image_brownbear.jpg"/> I misspelled bear(beat) so it would use the alt. If this is giving the link then sure you gave it and it displayed in the browser. The person using this web-page would then need to copy/paste the link to another browser tab to see the image. 3 Likes miracleony April 30, 2020, 2:44pm 17 Makes sense! Thank you! alij9165152815 June 3, 2020, 5:31am 18 Interesting topic, reminds me of the issue of naming variables in programming at large. I used “Brown Bear in Forest”, but even just “Bear” might suffice if we take into consideration that the surrounding text mentions that we are talking about brown bears. css8888791793 June 23, 2020, 7:50pm 19 Hi, Roy. I am still not clear about this topic. rubyslayer42889: For example, if the video doesn’t load we might want to display a link to another video that does. As attributes can not contain markup, this scenario would not be possible with alt attributes alone. The following code is an example of the fallback. The content inside the opening and closing <video></video> tags is shown as a fallback in browsers. Not all browsers support the same video format, so we can provide multiple video sources in the element, and the browser will use the first source it supports. <video controls width="250"> <source src="/media/examples/flower.webm" type="video/webm"> <source src="/media/examples/flower.mp4" type="video/mp4"> Sorry, your browser doesn't support embedded videos. </video> In terms of alt attribute, I don’t understand why you mentioned that attributes can not contain markup. Does this mean using the alt attribute to include a fallback video source? I assume the alt attribute does not need to include any HTML mark up (tags), and just include some descriptive words. So I think the fallback options have nothing to do with alt attribute. Could you please answer this question again without mentioning fallback? I know the alt attribute is not the permitted attributes for Video element, but I really don’t understand the reason. If the alt attribute is valid for video element, I think this alt attribute can work for any source of the video. I tried the following code and my Chrome browser still plays the video normally. <video controls width="250" alt="Flowers are in bloom"> <source src="/media/examples/flower.webm" type="video/webm"> <source src="/media/examples/flower.mp4" type="video/mp4"> Sorry, your browser doesn't support embedded videos. </video> 3 Likes mtf June 23, 2020, 8:41pm 20 If you look at the specs for VIDEO, you will find that there is no alt attribute in its attribute list. We want the user agent to slip down to the fallback text, which is neither descriptive or alternate text. Attributes won’t have any effect beyond what they are purposed for. That includes alt, so including it won’t show any signs of malfunction. Upload the HTML to a validator and it may advise that the alt is not expected. 3 Likes next page → Related topics Topic Replies Views Activity Can we use an alt attribute with the <video> tag? HTML FAQ 3 1348 January 24, 2024 Should the alt attribute show up when hovering on the image? HTML FAQ 27 40785 September 5, 2023 FAQ: Learn HTML - Intro to HTML - Videos HTML FAQ 97 8589 September 14, 2024 What is the purpose of Video Not Supported? HTML FAQ 22 26908 October 11, 2023 FAQ: Semantic HTML - Video and Embed HTML FAQ 32 4690 January 14, 2024 Từ khóa » Html5 Video Alt Text HTML5 Video Element — Alternative Text - Stack Overflow Media Alt Technologies - HTML Accessibility Task Force Wiki Optimizing For Accessibility: Alt Text, Videos, Images & More - Moz HTML Alt Attribute - W3Schools The Video Embed Element - HTML: HyperText Markup Language Alt Content For Html5 Video Tag Sucks - HTML & CSS - SitePoint Forums Why Is There No Alt Attribute Associated With The Poster ... - GitHub HTML Img Alt Tags For SEO Best Practice - Search Engines Love ... Image ALT Tag Tips For HTML - Accessibility At Penn State HTML5 Video Tag » The Definitive Guide [2022] | Bitmovin Adding A Video Alt Tag - YouTube Use Alt Attributes Appropriately On All Images | UCOP Image Alternative Text - Directive Consulting HTML | Alt Attribute - GeeksforGeeks