如果浏览器不支持HTML5的< video>图片,我如何显示图片?标签 [英] How can I display an image if browser does not support HTML5's <video> tag

查看:838
本文介绍了如果浏览器不支持HTML5的< video>图片,我如何显示图片?标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道如何为不支持标签的浏览器显示图片?显示如下文字:

 < video src =video.mp4type =video / mp4> 
您的浏览器不支持< video>标记
< / video>

很简单,但如果我用img标签替换文本,它将始终显示图像,即使当浏览器支持视频标签时也是如此。



感谢您分享您的知识
$ b (编辑)这是不是这样,我的测试是错误的,并且img标签确实只在视频不支持的情况下呈现(例如Safari 5)

解决方案

我只是在检查这个链接,以及HTML5的规范,所以此代码应该适合您:

 < video controls =controlsposter =< your image poster如果适用>> 
< source src =video.mp4type =video / mp4/>
< img src =<您的无视频支持图片> title =您的浏览器不支持< video>标记/>
< / video>


Does anyone know how can I display an image for the browsers which don't support the tag ? Displaying a text such as in:

<video src="video.mp4" type="video/mp4">
    Your browser does not support the <video> tag
</video>

Is easy, but if I replace the text with an img tag, it will always show the image, even when the browser DOES support the video tag.

Thanks for sharing your knowledge

(EDIT) This is not the case, my tests were wrong and img tag indeed gets rendered only when video is not supported (e.g. Safari 5)

解决方案

I was just checking this link, as well as HTML5's spec, so this code should work for you:

<video controls="controls" poster="<your image poster if applicable>">
    <source src="video.mp4" type="video/mp4" />
    <img src="<your No video support image>" title="Your browser does not support the <video> tag" />
</video>

这篇关于如果浏览器不支持HTML5的&lt; video&gt;图片,我如何显示图片?标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆