图像替代文字不起作用 [英] Image Alternate Text is Not Working

查看:154
本文介绍了图像替代文字不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我敢肯定,当有人指出我做错了什么时,我会自我打击,但是我不能为了我的生活找出替代文字为什么不能在图像出现时出现没有加载。



我有下面的代码,显然是一个图像的错误路径(模拟图像不加载的原因):

 < form> 
< input type =imagesrc =image / not.herealt =Search/>
< / form>

但是,我没有得到一个带有搜索文本的按钮,这是我

我可以做到这一点吗?



谢谢!



jsfiddle: http://jsfiddle.net/kralco626/hd4Dy/4/

解决方案

如果您使用Google Chrome浏览器/ Safari,浏览器不显示搜索比img宽。
您的代码没有问题。尝试在第二个输入标记上添加 style =width:700px; height:400px,以查看文本是否存在。



更多信息:

http://blog.paciellogroup.com/2010/01/alt-and-title-content-display-in-popular-browsers/



PS:IE正在显示搜索文本。


I'm sure I'm going to smack myself when someone points out what I'm doing wrong, but I cannot for the life of me figure out why I can't get an alternate text to appear when an image does not load.

I have the following code with obviously the wrong path to an image (to simulate the image not loading for some reason):

<form>
    <input type="image" src="image/not.here" alt="Search"/>
</form>

However, I don't get a button with the text "Search" on it which is what I would expect.

Can I accomplish this?

Thanks!

jsfiddle: http://jsfiddle.net/kralco626/hd4Dy/4/

解决方案

If you're using Google Chrome/Safari, the browser don't display the "Search" if it is longer than the img width. There's nothing wrong with your code. Try add style="width: 700px; height: 400px" on your second input tag just to see that the text is there.

Further information:

http://blog.paciellogroup.com/2010/01/alt-and-title-content-display-in-popular-browsers/

PS: I.E. is showing the "Search" text.

这篇关于图像替代文字不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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