cite 属性有什么用?
例如:
<q cite="http://www.example.com/quote">
<p>“A quote”</p>
<footer>—Person quoted</footer>
</q>
最终用户在普通浏览器中看不到引用文本的来源,那么谁使用这些信息以及如何使用?
The cite
attribute specifies the address of the source of the quoted text, I think, but who uses this information?
For example:
<q cite="http://www.example.com/quote">
<p>“A quote”</p>
<footer>Person quoted</footer>
</q>
The source of the quoted text isn't visible to the end-user in a normal browser, so who does use this information, and how?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
首先,您不仅可以在
blockquote
中使用cite
属性。您还可以在以下元素上使用
cite
属性:为什么要在上述元素中使用
cite
?指出内容的获取位置引用自、或更改或删除。
Here is what w3.org says,
现在的问题是,谁使用它?
cite
属性用于标识表单中引用的在线来源URI 的名称(例如“http://sourcewebsite.doc/document.html”)。cite
属性的值不会在屏幕上呈现(尽管可以通过 DOM 脚本的魔力提取这种潜在有用的元数据并将其写回到网页中)。因此,浏览器对此属性的支持被标记为“无”,但因为它具有其他潜在用途(用于搜索引擎索引、通过 DOM 脚本检索等),并且存在可能性<由于未来浏览器版本中会对该属性提供改进的本机支持,因此在使用上述元素时应使用
cite
属性。所以,目前没有人使用它,但将来可能会在用户代理或我的搜索引擎中使用,所以最好使用它。
First, it's not only
blockquote
where you can use thecite
attribute.You can use the
cite
attribute on the following elements also:Why would one use
cite
in above elements?To point to where the content is taken from, or change or deletion is referred.
Here is what w3.org says,
Now, the question, who uses it?
The
cite
attribute is used to identify the online source of the quotation in the form of a URI (for example, "http://sourcewebsite.doc/document.html").The value of the
cite
attribute isn't rendered on screen (although this potentially useful meta data could be extracted and written back into the webpage through the magic of DOM Scripting).As such, browser support for this attribute is marked as none, but because it has other potential uses (for search engine indexing, retrieval via DOM scripting, and more) and there is the likelihood of improved native support being provided for the attribute in future browser versions, you should use the
cite
attribute when you use the above elements.So, currently no one uses it, but in future maybe used in user-agent or my search engines, so better to use it.
标签和
cite
属性都是出于语义目的,这意味着它们只是为了赋予网站更多“意义”。例如,我可以使用标签来引用,而不是使用
标签和
cite
属性也是如此。根据cite
属性的 MDN 定义 (“那么谁使用这些信息以及如何使用?” - 我相信搜索引擎(例如谷歌)会使用此信息来显示文档之间的潜在链接。如果你考虑一下这一点,这是一个重点。查看下图:
请注意右侧如何显示“Samsung Group”信息框。在谷歌工作的人不会写这些信息——相反,它来自维基百科。然而,当此信息也写在其他网站上时,此信息将与搜索“samsung”具有更大的相关性,并且
cite
属性将此信息链接到维基百科(从而增加了维基百科的相关性)。这就是为什么这里使用维基百科的信息,而不是一些小学网站上有关三星手机的信息。cite
属性只是为网站提供更多含义。 Tim Berners-Lee 将语义网描述为“Web 3.0”的一个组件——换句话说,更新的 HTML 语言的许多组件只是为了给网页提供更多的含义,向 Web 3.0 更近了一步。TL;DR - 简单来说,
cite
属性只是为网页提供更多含义,并且可以用于搜索引擎以实现更好的网络链接。Both the
<cite>
tag and thecite
attribute are for semantic purposes, which means that they are simply for giving a website more "meaning". For example, I could use a<div>
tag for a quote, rather than using a<blockquote>
tag, but this provides less meaning to the browser, and hence using<blockquote>
is recommended for quotes.The same is with the
<cite>
tag andcite
attributes. As per the MDN definition for thecite
attribute (link here):"so who does use this information, and how?" - I believe that search engines (e.g. Google) would use this information to show potential links between documents. If you think about this it is a major point. Check out the image below:
Notice how it shows the "Samsung Group" information box on the right. The guys who work at Google don't write this information - rather, it is sourced from Wikipedia. However, this information would be of greater relevance to the search "samsung" when this information is also written on other websites, with the
cite
attribute linking this information to Wikipedia (hence increasing the relevancy of Wikipedia). This is why Wikipedia's information is used here, and not some primary school's website regarding Samsung phones.The
cite
attribute simply provides more meaning to the website. Tim Berners-Lee has described the semantic web as a component of "Web 3.0" - in other words, many components of the updating HTML language are simply to provide more meaning onto the webpage, as a step closer to Web 3.0.TL;DR - in simpler terms, the
cite
attribute is just to provide more meaning to the web page, and may be used for search engines for better web linkage.W3C 有这样的说法:
它是不可见的,我想不出它在哪里使用,除了搜索引擎。
W3C has this to say:
It's not visible and I can't think of anywhere it's used except perhaps by search engines.
它旨在由收集和整理数据的机器使用,例如。搜索引擎,但它可以被任何机器使用。其目的是使网页更加系统化,以便于机器阅读。因为他们无法仅根据上下文理解文本的哪一部分代表引用和引用。
您可以查找语义网以获取更多信息。
http://en.wikipedia.org/wiki/Semantic_Web
It is meant to be used by machine which collect and arrange data eg. search engines, but it can be used by any machine. It is meant to make webpages more systematic to be read by machine. As they can not understand which part of text represent citation and quote based on only context.
you can look up Semantic Web for more information.
http://en.wikipedia.org/wiki/Semantic_Web
是的,最终用户看不到报价来源。所以这只是对来源的引用。
来自 WHATWG.ORG 的定义:
Yes, the source of the quotation isn't visible to end user. So it's just a reference to the source.
Definition from WHATWG.ORG:
引用自 W3Schools:
http://www.w3schools.com/tags/att_q_cite.asp
Quoted from W3Schools:
http://www.w3schools.com/tags/att_q_cite.asp
它只是另一个元数据块,服务器端脚本可以使用它来收集统计数据,或者前端开发人员可以使用它来添加功能(他们可以选择打印源代码,允许访问原始源代码等)。
将原始源代码写在某个地方是一个很好的做法,尽管它实际上对最终用户来说并不是很有用。
It's just another meta data chunk that can be used by server side scripts to collect statistics or by front end developpers to add functionnalities (they can choose to print the source, allow to access the original source, etc...).
It's just a good practice to have the original source written somewhere although it is actually not very useful for the end user.