html元素上的title属性有什么用? [英] What is the use of the title attribute on a html element?

查看:57
本文介绍了html元素上的title属性有什么用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

html元素上的title属性有什么用途?

What is the use of the title attribute on a html element?

<div class="myDiv" title="This is the title"> Stuff </div>

是否打算用作工具提示?还有其他用途吗?

Is it intended to be used as a tooltip? Does it have any further use?

推荐答案

相当多.HTML规范将其称为建议文本,但它使用了以及工具提示"一词,因为它通常是这样表示的:

Pretty much. The HTML spec calls it advisory text, but it uses the word "tooltip" as well, because that's how it is typically represented:

title 属性表示元素的咨询信息,例如适用于工具提示的信息.在链接上,这可以是目标资源的标题或描述.在图片上,可能是图片来源或图片说明;在一个段落上,它可以是文本的脚注或评论;引用时,可能是有关来源的更多信息;在交互式内容上,它可以是元素使用的标签或使用说明;等等.该值为文本.

The title attribute represents advisory information for the element, such as would be appropriate for a tooltip. On a link, this could be the title or a description of the target resource; on an image, it could be the image credit or a description of the image; on a paragraph, it could be a footnote or commentary on the text; on a citation, it could be further information about the source; on interactive content, it could be a label for, or instructions for, use of the element; and so forth. The value is text.

它相对于内容的作用完全取决于内容所提供的上下文,但通常,它充当该内容的可选补充信息.

Its role in relation to the content depends entirely on the context given by the content, but in general it serves as optional, supplementary information for that content.

这篇关于html元素上的title属性有什么用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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