HTML参考手册
属性 | Attributes
itemtype(属性) | itemtype (attribute)
全局属性itemtype
指定将用于定义itemprop
数据结构中的(项目属性)的词汇表的URL 。itemscope
用于设置数据结构中设置的词汇itemtype
将处于活动状态的范围。
谷歌和其他主要的搜索引擎支持schema.org词汇表的结构化数据。这个词汇表定义了一组标准的类型名称和属性名称。例如,MusicEvent
表示音乐会表演,startDate
以及location
指定音乐会关键细节的属性。在这种情况下,MusicEvent
itemtype
,与startDate
和MusicEvent
定义的位置将被itemprop
URL使用。
注意:关于itemtype
属性的更多信息可以在http://schema.org/Thing找到
- 项目类型属性必须有一个值是一组无序独特标记,其区分大小写的,各是一个有效的和绝对的URL,并且所有定义为使用相同的词汇。该属性的值必须至少有一个令牌。
- 项目类型必须全都是适用规范中定义的类型(如schema.org),并且必须全部定义为使用相同的词汇表。
- itemtype属性只能在指定了itemscope属性的元素上指定。
- itemid属性只能在同时指定了itemscope属性和itemtype属性的元素上指定。它们只能在具有itemscope属性的元素上指定,其itemtype属性指定不支持项目的全局标识符的词汇表,如词汇表规范所定义。
- 全局标识符的确切含义由词汇表的规范决定。留下这样的规范来定义是否允许相同全局标识符(无论在同一页面还是不同页面上)的多个项目存在,以及该词汇表的哪些处理规则是关于处理多个项目的情况相同的ID。
简单的例子
HTML
<div itemscope itemtype="http://schema.org/Product">
<span itemprop="brand">ACME</span>
<span itemprop="name">Executive Anvil</span>
</div>
结构化数据
itemscope |
itemtype |
schema.org Product |
---|---|---|
itemprop |
name |
Executive Anvil |
itemprop |
brand Thing |
|
itemprop |
name |
ACME |
样例
HTML
<div itemscope itemtype="http://schema.org/Product">
<span itemprop="brand">ACME<br></span>
<span itemprop="name">Executive Anvil<br></span>
<img itemprop="image" src="https://pixabay.com/static/uploads/photo/2015/09/05/18/15/suitcase-924605_960_720.png" width="50" height="50" alt="Executive Anvil logo" /><br>
<span itemprop="description">Sleeker than ACME's Classic Anvil, the
Executive Anvil is perfect for the business traveler
looking for something to drop from a height.
<br>
</span>
Product #: <span itemprop="mpn">925872<br></span>
<span itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
Rating: <span itemprop="ratingValue">4.4</span> stars, based on <span itemprop="reviewCount">89
</span> reviews
</span><p>
<span itemprop="offers" itemscope itemtype="http://schema.org/Offer">
Regular price: $179.99<br>
<meta itemprop="priceCurrency" content="USD" />
<span itemprop="price">Sale price: $119.99<br></span>
(Sale ends <time itemprop="priceValidUntil" datetime="2020-11-05">
5 November!</time>)<br>
Available from: <span itemprop="seller" itemscope itemtype="http://schema.org/Organization">
<span itemprop="name">Executive Objects<br></span>
</span>
Condition: <link itemprop="itemCondition" href="http://schema.org/UsedCondition"/>Previously owned,
in excellent condition<br>
<link itemprop="availability" href="http://schema.org/InStock"/>In stock! Order now!
</span>
</div>
结果
HTML
结构化数据
itemscope |
itemtype |
Product (http://schema.org/Product) |
|
---|---|---|---|
itemprop |
name |
Executive Anvil |
|
itemprop |
image |
https://pixabay.com/static/uploads/photo/2015/09/05/18/15/suitcase-924605_960_720.png |
|
itemprop |
description |
Sleeker than ACME's Classic Anvil, the Executive Anvil is perfect for the business traveler looking for something to drop from a height. |
|
itemprop |
mpn |
925872 |
|
itemprop |
brand Thing |
|
|
itemprop |
name |
ACME |
|
itemscope |
itempropitemtype |
aggregateRatingAggregateRating |
|
itemprop |
ratingValue |
4.4 |
|
itemprop |
reviewCount |
89 |
|
itemprop |
offers Offer |
http://schema.org/Offer |
|
itemprop |
priceCurrency |
USD |
|
itemprop |
price |
119.99 |
|
itemprop |
priceValidUntil |
2020-11-05 |
|
itemprop |
itemCondition |
http://schema.org/UsedCondition |
|
itemprop |
availability |
http://schema.org/InStock |
|
itemscope |
itempropitemtype |
seller Organization |
http://schema.org/Organization |
itemprop |
name |
Executive Objects |
注意:用于从HTML中提取微数据结构的便捷工具是Google的结构化数据测试工具。试试上面显示的HTML
产品规格
规范 |
状态 |
评论 |
---|---|---|
物品种类 |
|
工作组注意事项 - 不再积极发展 |
浏览器兼容性
Feature |
Chrome |
Firefox (Gecko) |
Internet Explorer |
Opera |
Safari |
---|---|---|---|---|---|
Basic support |
(Yes) |
(Yes) |
(Yes) |
(Yes) |
(Yes) |
Feature |
Android |
Chrome for Android |
Firefox Mobile (Gecko) |
IE Mobile |
Opera Mobile |
Safari Mobile |
---|---|---|---|---|---|---|
Basic support |
(Yes) |
(Yes) |
(Yes) |
(Yes) |
(Yes) |
(Yes) |
属性 | Attributes相关
超文本标记语言,它通过标记符号来标记要显示的网页中的各个部分。网页文件本身是一种文本文件,通过在文本文件中添加标记符,可以告诉浏览器如何显示其中的内容(如:文字如何处理,画面如何安排,图片如何显示等)。浏览器按顺序阅读网页文件,然后根据标记符解释和显示其标记的内容,对书写出错的标记将不指出其错误,且不停止其解释执行过程,编制者只能通过显示效果来分析出错原因和出错部位。但需要注意的是,对于不同的浏览器,对同一标记符可能会有不完全相同的解释,因而可能会有不同的显示效果。