假设我有一个我想注释的HTML段落(即添加一些不应显示的上下文,只需在文本中添加含义)
<p>The ultimate measure of a man is not where he stands
in moments of <tag data="some custom annotation">comfort and convenience</tag>,
but where he stands at times of challenge and controversy.</p>
在这种情况下应该使用什么正确的语义标记?
3c。缺少/隐含信息:将meta标签与内容一起使用
有时,网页上包含的信息可能会很有价值,向上,但由于信息的方式而无法对其进行标记出现在页面上。信息可以图像形式传达(用于例如,用于表示评分为4分(满分5分)的图片或Flash对象(例如,视频剪辑的持续时间),也可能是暗示但未在页面上明确说明(例如,价格的货币)。在这种情况下,请使用meta标记以及content属性来指定信息。考虑这个示例,该图像向用户显示了一个5星评级4星:
<div itemscope itemtype="http://schema.org/Offer"> <span itemprop="name">Blend-O-Matic</span> <span itemprop="price">$19.95</span> <img src="four-stars.jpg" /> Based on 25 user ratings </div>
这里再次是示例,其中标记了评分信息。
<div itemscope itemtype="http://schema.org/Offer"> <span itemprop="name">Blend-O-Matic</span> <span itemprop="price">$19.95</span> <div itemprop="reviews" itemscope itemtype="http://schema.org/AggregateRating"> <img src="four-stars.jpg" /> <meta itemprop="ratingValue" content="4" /> <meta itemprop="bestRating" content="5" /> Based on <span itemprop="ratingCount">25</span> user ratings </div> </div>
应谨慎使用此技术。仅将带有内容的元数据用于否则无法标记的信息。
有关准备使用的示例,您可以参考schema.org website。每个术语定义均显示两种序列化的用法。您的HTML可能是:
微数据
<p itemscope itemtype="http://schema.org/Person">
The ultimate measure of a man is not where he stands in moments of
<span itemprop="description">comfort and convenience</span>,
but where he stands at times of challenge and controversy.
</p>
<p vocab="http://schema.org/" typeof="Person">
The ultimate measure of a man is not where he stands in moments of
<span property="description">comfort and convenience</span>,
but where he stands at times of challenge and controversy.
</p>
<span>
来封装带注释的文本。其他方面RDFa和Microdata没什么不同。也请查看RDF Translator app。它将帮助您摆弄注释。