问题
I have a following piece of HTML with some Schema.org Microdata added:
<section class="feature" itemprop="description">
<div class="measure">
<p>Lorem ipsum etc...</p>
<p>Lorem ipsum etc...</p>
<figure class="polaroid product">
<img src="dry-aged-beef-horizontal.jpg", alt="Dry Aged Beef", itemprop="image" />
<figcaption>Dry Aged Beef</figcaption>
</figure>
</div>
</section>
Is it all right to use the itemprop
attribute on an element that isn't itself a text node (like section
above), but contains child elements that are?
Looking at the official Schema.org examples one could become suspicious that only text elements can be tagged with Microdata attributes:
<span itemprop="description">0.7 cubic feet countertop microwave. Has six preset cooking categories and convenience features like Add-A-Minute and Child Lock.</span>
Also, my product description consists of more paragraphs than one, so again setting the itemprop
tag on a parent element makes all the sense. Is this correct Microdata/Schema.org though?
回答1:
Microdata (W3C Note) defines that the property value is, in the general case (which applies in your example):
[…] the element's
textContent
.
So yes, your usage is fine.
(Of course this means that "Dry Aged Beef" will also be part of the description
value.)
来源:https://stackoverflow.com/questions/24241779/using-microdatas-itemprop-attribute-on-non-text-elements